Android: "configuration cannot be published" while Uploading APK to Play Store - android

Need help with an Android Play Store issue I've seen while trying to update our app.
The problem appears when the apk upload is done, and the following message shows up:
This configuration cannot be published for the following reason(s):
It is forbidden that a device upgrading from API levels in range 14-18 to API levels in range 19+ should downgrade from version 10 to version 9, which would occur when
Screen layouts containing any of [small, normal, large, xlarge] and
Features containing all of [android.hardware.LOCATION, android.hardware.location.GPS, android.hardware.screen.PORTRAIT, android.hardware.TOUCHSCREEN, android.hardware.WIFI].
Some devices are eligible to run multiple APKs. In such a scenario, the device will receive the APK with the higher version code.
What is somewhat strange is that the Play Store lists our supported API levels as 14-18, whereas our SDK settings are as follows:
/* build.gradle */
...
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "<my app id>"
minSdkVersion 14
targetSdkVersion 21
}
...
/* AndroidManifest.xml */
...
android:versionCode="10"
android:versionName="1.1.1" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
...
Another (perhaps minor) issue is that the following permission is listed under the APK DETAILS tab of the Play Store despite that we don't set this in our manifest file:
android.permission.CHANGE_WIFI_STATE
When we switch the build/target SDK version to 19 (as we previously did), Android Studio correctly complains that we are not using the latest Android version. Even then, we still see the upload problem.
Might there be something else in our configuration that is wrong?
Thanks in advance for your assistance!

OK, I finally managed to solve the issue.
Used aapt to see how Play Store would parse the apk
Found out that an external, closed-source library that I'm using sets a maxSdkVersion=18 in its manifest library
Obtained a version of the offending library that doesn't have the max SDK setting.
Recompiled the app and successfully uploaded to the play store.
An alternative to step 3 would have been to override the maxSdkVersion in my main AndroidManifest.xml file, or Disable Manifest Merger in Android Gradle Build in gradle, but Android Studio wasn't very cooperative on that front.
Admittedly, the error message on Play Store is rather cryptic and could be worded better.

Related

Set the supported lowest supported Android version in a Nativescript app.

I've deployed a Nativescript app to Google Play for my beta testers to use. My app is only intended to support Android version 4.4 and above. So I thought setting this in the AndroidManifest would get the job done.
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="__APILEVEL__"/>
Yet once deployed the Play store is still saying that those running Android versions lower than 4.4 can still download the app. What else do I need to do to prevent this?
Follow the thread below where a solution is shown on how to modify your minimum SDK version with app.gradle
https://github.com/NativeScript/android-runtime/issues/575#issuecomment-251584253
Basically as Plamen5kov has shown, you have to do the following:
what you can do is go to app/App_Resources/Android/app.gradle and
change the default configuration to meet your requirements.
android {
defaultConfig {
minSdkVersion 19 ....
Gradle overrides the AndroidManifest.xml that's why you need to change
the configuration in gradle, rather than in the manifest file.

Android APK failed to upload to play store Strange issue

I am having this issue for two years. I can't be able to upload android APK to play store. The app is written in phonegape and I compile the Signed APK from android studio.
What I am having error is:
Your APK's version code needs to be higher than 100008.
Facts:
There are nothing like 100008 word or number in whole project.
I changed All version codes to 100009, still same error
Android Studio uses Gradle to build your projects.
To increment the android version code using Gradle add the following to build.gradle in your app module:
defaultConfig {
minSdkVersion XX
targetSdkVersion YY
versionCode 100009
versionName "Your Version Name"
}
Replacing where necessary. The key part is the versionCode must be higher than what is already on the store.
I suggest you to decompile your apk and check a version in the result manifest file.
You may use this tool http://ibotpeaches.github.io/Apktool/
Hope it helps!
I guess you have read this already: https://developer.android.com/studio/publish/versioning.html

Android: able to install app for unsupported Android version

We're dropping support for Android 2.3 (API level 9) devices because most of our users have a newer Android version on their phones. I've updated the minimum SDK version to api level 14.
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
}
}
However I'm still able to install the app on Android 2.3 devices manually (not by store). Is this expected behavior or am I doing something wrong? I couldn't find the answer somewhere else.
Another strange issue is that Lint doesn't detect the correct api level.
listView.setFastScrollAlwaysVisible(true);
This results in the warning: Call requires api level 11 (current min is 9).
However my current minimum is now 14. So this indicates to me that i did something wrong. I tried cleaning and rebuilding the project, restarting Android Studio. It all didn't work.
Can anyone help me out?
Edit
Based on Sufians comment I started fiddling around with my gradle files and I came to the following solution. However some questions still remain.
My project structure looks like this:
android.gradle (top-level build file which contains SDK versions)
main module (contains base code for other modules)
build.gradle (apply from: '../android.gradle')
sub module A (module specific changes)
build.gradle (has dependency on main module)
sub module B (module specific changes)
build.gradle (has dependency on main module)
I have a top-level build file android.gradle which contains the SDK versions. My modules then include the build file by apply from: '../android.gradle'. If I put the minSdkVersion directly in de main module the warnings disappear. Is that the way it should be? or do I need to set an minSdkVersion for every submodule? Or is there another way so that the SDK versions can stay within the android.gradle file?
Ok... I finally realized that there is nothing wrong in my project structure. The only thing I needed to do was press the little 'Sync Project with Gradle Files' button. After that all errors disappear.
Also I concluded that it's possible to install unsupported apps manually.
However the Google Play Store should prevent users from installing or updating the app.
i have personally never developed anything for android but when installing apps the device has never complained when installing an .apk that wasn't supported by the OS version.
even when the store said it wasn't supported i'm always able to install it as a .apk so i think it can't really be blocked.
Yes, you can install the app manually on your device as long the minimum API level specified in your manifest is less than your device's API level.
When you upload your app to the store, the store will not show your app to users with devices having Android version less than the min API level specified (API level 9 in your case).
As for the Lint warnings, make sure that the minimum/maximum SDK versions in your manifest file match those specified in the build.gradle file.
and you can also make sure that new APIs are not executed on older API levels by checking the OS version in the code.
http://developer.android.com/reference/android/os/Build.VERSION.html
If I put the minSdkVersion directly in de main module the warnings
disappear. Is that the way it should be?
Your main module's minimum and target SDKs (i.e inside the build.gradle of the module) will be that of your application.
The project's build.gradle should not contain any of this information.
or do I need to set an
minSdkVersion for every submodule? Or is there another way so that the
SDK versions can stay within the android.gradle file?
Each module defines its own minimum SDK. If you're using a third party module/library, you better not change it, unless you know what you're doing.

Android manifest not updating app version from Gradle build

Based on this Google document I'm expecting Gradle to update my manifest.xml file with a version number, notably this quoted section:
The defaultConfig element configures core settings and entries in the manifest file (AndroidManifest.xml) dynamically from the build system. The values in defaultConfig override those in the manifest file.
However when I change the version code or version name of my Gradle file, the values arent' changed in my manifest.
Is this normal behavior?
Which values, between the manifest and the gradle build, are stting version codes and names?
How can I make the connection between the manifest versions and the gradle build more visible?
Even I am facing the similar issue. It is the default behaviour of gradle system I guess. You need to update both AndroidManifest.xml and build.gradle seperately if there is any changes in sdk versions, version code, version name,etc. I am looking forward that these kinda issues must be fixed in upcoming releases.
I have versionCode(1.0.3) and versionName(8) in my build.gradle only and it had worked correctly for me in past.
Now I updated the versionCode to 1.0.4 and versionName to 1 but it kept on giving me error on Google play. I even tried adding the new versionCode and versionName to AndroidManifest.xml but it did not help. Only thing that worked was updating the versionName to a higher number (9). Something seems broken in the Google Play upload apk and verify mechanism. Hopefully my answer would save someone else's 1 hour for solving this silly bug.

Setting maximum TargetSDK for the apk

I have a app on the Google Play with the following configuration. Till now I thought that Google Play uses AndroidManifest to determine the minimum and the maximum SdkVersion. Unfortunately as it reveals people could download and install this app on higher APIs.
The question is; how to set maximum API limit for this app (I guess I need to set compileSdkVersion 17 in build.gradle but I have to be sure) before publish the apk.
AndroidManifest.xml (an extract):
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
build.gradle (an extract):
android {
compileSdkVersion 19
//...
}
You are setting targetSdk Version and minSdkVersion
maxSDK Version is a different attribute.
but is discouraged to set it
heres the full version of the code, from developer.android.com
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
As the Google play store indirectly choose the version ,after upload of the apk it looks after our android manifest.xml from there it takes all the information like minsdkversion and maxsdkversion in that manner our app will support based on that values it contain..

Categories

Resources