Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have a question about development with android stuido 3.2 and higher #629

Closed
nrikiji opened this issue Jan 18, 2019 · 17 comments
Closed
Labels

Comments

@nrikiji
Copy link

nrikiji commented Jan 18, 2019

When opening the platform / android project created after executing the following command with android studio 3.2 or later, the following error occurs and it can not be built.

Does this have problems with my environment? Or is it that it does not correspond to android stuido 3.2 or higher with correct behavior?

create android project

$ cordova create test com.example.test Test && cd $_
$ cordova platform add android@7.1.1

error

ERROR: The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Move minSdkVersion to build files and sync project
Affected Modules: CordovaLib, app

WARNING: The targetSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Move targetSdkVersion to build file and sync project
Affected Modules: app

environment

npm 6.4.1
node v10.15.0
cordova 8.1.2
@brodybits brodybits added the bug label Jan 18, 2019
@brodybits
Copy link
Contributor

I spotted similar error messages with android@nightly (8.0.0-dev) on Android Studio 3.3. Android Studio 3.3 offered me an option to fix the project automatically.

If I would accept the option to fix the project, Android Studio 3.3 would automatically update the following files to define minSdk and targetSdk values in Gradle instead of AndroidManifest.xml:

  • platforms/android/CordovaLib/AndroidManifest.xml
  • platforms/android/CordovaLib/build.gradle
  • platforms/android/app/build.gradle
  • platforms/android/app/src/main/AndroidManifest.xml

I think a similar kind of a solution would be needed to resolve the issue discussed in #508 (inconsistent handling of min/target SDK values), but may need some rework to respect the Gradle properties documented in https://cordova.apache.org/docs/en/latest/guide/platforms/android/#setting-gradle-properties.

Marked as a bug, hope we can resolve it before the major release for Cordova 9 (apache/cordova#10).

@nrikiji
Copy link
Author

nrikiji commented Feb 1, 2019

I spotted similar error messages with android@nightly (8.0.0-dev) on Android Studio 3.3. Android Studio 3.3 offered me an option to fix the project automatically.

Thank you very much. Would you please tell me where this option can be set

@JacobSiegle
Copy link

In android studio let the gradle build run and fail. In the error log it will have a message about auto fixing/refactoring the issue. Click the message then hit refactor in the bottom left.

brodybits pushed a commit to brodybits/cordova-android that referenced this issue Feb 10, 2019
since uses-sdk values are now superseded by Gradle files

resolves apache#629
@janpio
Copy link
Member

janpio commented Feb 12, 2019

Is this really fixed by this PR merge @brodybits?

@brodybits
Copy link
Contributor

Is this really fixed by this PR merge @brodybits?

Should be

@brodybits
Copy link
Contributor

I would like to reopen this issue until we get a chance to actually test it and ensure the resulting issue #666 is resolved.

@brodybits brodybits reopened this Feb 12, 2019
@BorntraegerMarc
Copy link

@brodybits I specify the min SDK version like so:

<platform name="android">
        <preference name="android-minSdkVersion" value="21" />
</platform>

Does your PR also respect this preference? And if yes: Do you when your enhancement is released? Using cordova-android v8 atm

@brodybits
Copy link
Contributor

brodybits commented Feb 26, 2019 via email

@BorntraegerMarc
Copy link

@brodybits I just created a brand new cordova app like described here: https://cordova.apache.org/docs/en/latest/guide/cli/index.html

Configured the android platform to v8.0.0

Ran cordova platform add android and cordova build android. When opening the project with android studio I get this notification:
screenshot 2019-02-28 at 09 59 51

So I click "update" and then I get this error:
screenshot 2019-02-28 at 09 44 12

The app still runs and it works when I click then on "move" in android studio. But it would be nice not to need to do that

@nprather
Copy link

This should be resolved in cordova-android@8.0.0. If not then please provide https://stackoverflow.com/help/mcve demo of the issue.

I'm running android 8.0 and received this same error about the minsdk location and did the Refactor to fix option too...

@piotr-cz
Copy link

piotr-cz commented Mar 21, 2019

Fix by @brodybits brodybits has been reverted in #666 before cordova-android 8.0 has been released.
Seems that it didn't work correctly in one specific scenario

@erisu
Copy link
Member

erisu commented Apr 6, 2019

This should have be resolved with PR #699 and is now merged into master. It will be available in the next release.

@erisu erisu closed this as completed Apr 6, 2019
@BorntraegerMarc
Copy link

Thanks for the update @erisu

Do you know when the next release will happen?

@mcastets
Copy link

8.1.0 is out today! I can confirm this issue is now fixed! Awesome work guys!

@tryhardest
Copy link

so it's like cat-and-mouse. If you upgrade to 8.1.0 you get Can't install plugin: Cannot read property '0' of undefined #581

So you upgrade Branch to 4.0.0. Then another error (check "Branch.h missing") on iOS when on 4.0.0.

@breautek
Copy link
Contributor

so it's like cat-and-mouse. If you upgrade to 8.1.0 you get Can't install plugin: Cannot read property '0' of undefined #581

So you upgrade Branch to 4.0.0. Then another error (check "Branch.h missing") on iOS when on 4.0.0.

Sounds like a plugin problem, not a cordova-android problem.

@tryhardest
Copy link

@breautek accurate. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests