-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Bug: Cordova does not set the minSdkVersion and targetSdkVersion from config.xml correctly in the APK. #686
Comments
From Android Studio, go to "File" >> "Project Structure". In "Project Structure" select "app" into the "Modules", then "Flavors" tab and set "Min SDK Version" I hope to be helpful |
This is the Android Studio solution for a native app. Thanks. But not my problem. It's about the compiled App (apk) from Cordova. There is a file You mean I have to load the Android project from I could set the <uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="22" /> Not tested, but I'll try it as workaround. btw. there are several AndroidManifest.xml files.
Ok, maybe this is not the correct file. But funny, because I set min: 22 and target: 23. I'll continue by successive approximation. ... |
I can confirm this bug: the minSdkVersion is ignored from the config.xml (I specify minSdkVersion=21 and the output apk targets 19 which is android 4.4). None of my Cordova plugin sets this minsdkversion to 19 so there is an issue with cordova-android itself. As a workaround I've created a build-extras.gradle with the following content:
I copy this file in the platforms/android folder with a before_build hook and it does the job. I hope it can help until this issue is addressed. |
@EmeryGuillaume Thanks for the hint. It's a great workaround. The build.gradle file contains the default values which I can overwrite before build. That looks promising. |
@Domvel exactly, if you can override directly the build.gradle file, it's a good workaround too. |
I do not attain that it change of version. It follows compiling in android 6.2.2 |
upgrading cordova-android to from 7.1.4 (where this bug got introduced I think) to 8.0.0 also solves this problem, due to this fix probably: After changing to config.xml to |
Modifying this does not work
|
Ah, I missed that this was reported with cordova-android@7.x. Closing as it's been fixed in cordova-android@8. |
NOTE You have to clean the platform. Otherwise the Also note that Android does not handle the minSdkVersion value correctly if you try to install the apk manually (copy apk to device and install by file manager). You'll get a parsing error like "There was a problem parsing the package". That's confusing. I expected a message like "This app is not compatible for your Android version." ... But it looks like this is a file manager issue. If I try to install this app by |
I update and believes a new project ...
|
Cordova Android 8.x targets android-28 and requires version 28 of the build tools. android-19 is the minimum OS version where the app will run, but building requires SDK 28. |
I have the 28 also. It works. But it does not compile for old versions |
NOTE Google PlayStore does not accept target level below 26. Whatever... it's recommended to keep the Cordova set target (which is always the latest known Android) and only set the Min-SDK-Level if wanted. |
But I could publish in android 5 or 4 with sdk 28? |
@b4zz4 Yes. Just ignore the target-sdk-level. Remove it from config.xml. It's handled by Cordova and your build-tools. (Should be the latest known Android version.) You can use the min-sdk-level value to control the required Android version. (by default 19) This can be set on the lowest possible value to reach the most users. But I recommend to ignore the old versions (e.g. Android lower than 6. See statistics of usage. To avoid support requests and rage rating.) It's also generally recommended to use the latest software / libraries e.g. Android-Cordova. |
Another alternative? neither the tips of @EmeryGuillaume and @b4zz4 work for me, always back to minsdk 21 |
I solved changing lines in file:
to
thanks @b4zz4 for cite the file |
Question, does this set the android version to api 27?
|
in your AndroidManifest.xml you can specify it like Also can set in config.xml
|
How to set the
Requires Android
version in Play Store? It is always 4.4 for all Ionic / Cordova Android Apps. (See Play Store app details)The preference
android-minSdkVersion
inconfig.xml
is set to 22 (Android 5.1). Alsoandroid-targetSdkVersion
has no effect. And I found nothing in the developer section of Play Store.Google Play Console says
API-Levels: 19+
. I think it comes from the apk. But how to set it?minSdkVersion
does not work.Cordova Android is not respecting the config.xml sdk version properties, right?
API-Levels
==android-minSdkVersion
Ionic Info:
The text was updated successfully, but these errors were encountered: