uses-sdk in AndroidManifest - android

I'm a little confused about something.
I wrote an app and tested it on an LG Ally with the following specs:
Android version: 2.2.2
Kernel version: 2.6.32.9
Build number: FRG83G
Now I'm trying to install it (via adb install AppName.apk) on an HTC with the following specs:
Android version: 2.3.3
Kernel version: 2.6.35.10-gc0a661b HTC-kernel#and 18-2#1
Build number: 4.24.651.1 CL61076
and I get an error like 'error parsing package'
Here's where I get confused. I wanted to try duplicate the problem. So I created an emulator AVD with the specs:
Android version: 4.0.3
Kernel version: 2.6.29-g46b05b2 vchtchetkine#vc-irv #28
Build number: google_sdk-eng 4.0.4 MR1 302030 test-keys
And....I am able to install my app successfully with the adb install command that will NOT install the app on the HTC.
I don't understand why I'm able to use 'adb install' to put it on the LG Ally and the emulator but I get the parse error on the HTC.
I thought I might need in the AndroidManifest but then why am I able to install on the emulator without it?
My manifest is below (I removed the activity definitions for brevity):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mj.molepatrol"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<uses-library android:name="com.google.android.maps" />
</application>
<uses-permission
android:name="android.permission.READ_CALENDAR">
</uses-permission>
<uses-permission
android:name="android.permission.WRITE_CALENDAR">
</uses-permission>
<uses-permission
android:name="android.permission.EDIT_CALENDAR">
</uses-permission>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest>

Try to use
<uses-sdk android:minSdkVersion="10">
It will solve your problem. Because, I read this documentation about uses-sdk,
Caution: If you do not declare this (uses-sdk android:minSdkVersion) attribute, the system assumes a default value of "1", which indicates that your application is compatible with all versions of Android. If your application is not compatible with all versions (for instance, it uses APIs introduced in API Level 3) and you have not declared the proper minSdkVersion, then when installed on a system with an API Level less than 3, the application will crash during runtime when attempting to access the unavailable APIs. For this reason, be certain to declare the appropriate API Level in the minSdkVersion attribute.
Source: Android Developers Website

The possible problem for this is that you are using a feature that is not available to the device. Such as a camera or NFC.
You have only set minSdkVersion and targetSdkVersion right?
There will be something in the manifest that the htc doesn't like, please post your AndroidManifest.xml file so we can see specifics and figure it out for you

Related

App in Google Play Store (Beta-Test) says "App not compatible with your devices"

i have written an android app with xamarin.android in visual studio and compiled a release build for android 4.1 and higher. testing directly with my devices works without problems.
after building an apk and uploading it in the play store for a beta test, it says: "app not compatible with your devices". i am pretty sure, that my test devices are not the problem. what could it be??
here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="xxx" android:versionCode="1" android:versionName="1.1" android:installLocation="auto">
<uses-sdk android:minSdkVersion="14" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application android:label="alone" android:icon="#drawable/Icon"></application>
</manifest>
on developer interface it says 10106 supported devices:
any ideas? thanks for your help...
best regards from germany,
steven
I dont use xamarin , but using studio if your gradle hava a different min sdk it will overwrite whatever os on you manifest , check your gradle file .

Android Marshmallow, api 23, permissions broken on a Cordova application

I inherited a Cordova hybrid application with an error in its manifest file. The targetSdkVersion is set to 24 which, as far as I am concerned doesn't exists yet.
The app wasn't tested on an Android 6 device so it was uploaded to Play Store with that error. Since the permission model on Android 6 has changed the app crashes on those devices.
03-12 21:10:05.991 24366-24475/? E/PluginManager﹕ Uncaught exception from plugin
java.lang.SecurityException: getDeviceId: Neither user 10111 nor current process has android.permission.READ_PHONE_STATE.
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getDeviceId(ITelephony.java:4207)
at android.telephony.TelephonyManager.getDeviceId(TelephonyManager.java:706)
at org.pgsqlite.SQLitePlugin.getAppKey(SQLitePlugin.java:783)
at org.pgsqlite.SQLitePlugin.executeSqlBatch(SQLitePlugin.java:347)
at org.pgsqlite.SQLitePlugin.executeAndPossiblyThrow(SQLitePlugin.java:195)
at org.pgsqlite.SQLitePlugin.execute(SQLitePlugin.java:93)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:95)
at org.apache.cordova.PluginManager.exec(PluginManager.java:130)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:39)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
Thanks to this blog I found that if I change the targetSdkVersion to 22 the app works as before
http://inthecheesefactory.com/blog/things-you-need-to-know-about-android-m-permission-developer-edition/en
And the documentation shows how to ask for permissions at run time:
http://developer.android.com/intl/es/training/permissions/requesting.html
I have several questions regarding this issue.
If I downgrade the targetSdkVersion to 22 (or 23 for that matter) and upload the app to Play Store, would the app update if I increase the version? I don't really know what would happen.
How should I work with permissions on Android Marshmallow on a cordova App? Should I ask for permissions int the activity overriding the default one created by Cordova after installation?
Are there any other ideas to solve this issue?
Here is my manifest.xml file.
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0" android:windowSoftInputMode="adjustResize" package="com.myorg.myapp" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="24" />
<application android:allowBackup="true" android:icon="#drawable/icon" android:label="#string/app_name">
<blablabla />
</application>
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
</manifest>
If I downgrade the targetSdkVersion to 22 (or 23 for that matter) and upload the app to Play Store, would the app update if I increase the version? I don't really know what would happen.
You can upload a new app built against API 22 to the Play Store and subsequently upload a build against API 23 - this will work fine. However (as #jcesarmobile points out in the comments), we're pretty sure Google won't let you downgrade to API 22 if you have an existing app in the Play Store that's been uploaded with API 23. So your choices here are to fix it for API 23 (best option) or otherwise change the package name and publish it as a new app built with API 22, then remove the old one (not ideal).
Currently there's nothing forcing you to build against API 23, and so in the short term you can continue to build and deploy against API 22. However, I would think at some point Google will require uploaded builds to use API 23, otherwise the type of malicious apps that runtime permissions are designed to combat will just continue building against API 22 and bypassing runtime permissions
How should I work with permissions on Android Marshmallow on a cordova App? Should I ask for permissions int the activity overriding the default one created by Cordova after installation?
Most (if not all) of the core plugins provided by Cordova (e.g. cordova-plugin-camera), and some 3rd party plugins, have been updated to request the necessary runtime permissions that they use when building/running on API 23. So the first thing is to make sure the plugins in your project are up-to-date with the most recent releases. I wrote a little tool to for managing plugin updates which makes this process a bit easier: cordova-check-plugins.
From the error message you posted, it appears that the crash is due to the READ_PHONE_STATE permission not having been requested by the plugin, which looks to be the SQLite storage plugin. Not sure if this plugin has been updated to request/step around runtime permissions, so check that first. A simple plugin update might resolve this one.
If not, or for other plugins which don't yet support requesting of API 23 runtime permissions, you have two options:
Modify the plugin source code to request the necessary runtime permissions. This will take a bit of Java surgery. The Cordova plugins make use of a re-usable Permission helper class which makes this easier. You could optionally feed back your changes to plugin authors with a pull request.
Use cordova-plugin-diagnostic to request the permissions required by the non-compliant plugins. This can be done in the Javascript layer and doesn't requiring modifying the plugin source code.
Firstly, you need to determine which permissions the plugin uses. You can look in the plugin.xml for this. If for some reason the plugin doesn't add the relevant <uses-permission/> element to the AndroidManifest.xml, you can add it explicitly to your config.xml (note that cordova-plugin-dignostic will not add <uses-permission/> elements for you).
Then wrap the Javascript call to the plugin with a call to cordova-diagnostic-plugin to check and request the relevant runtime permission as appropriate. Using READ_PHONE_STATE as an example:
function requestPermission(){
cordova.plugins.diagnostic.requestRuntimePermission(function(status){
switch(status){
case cordova.plugins.diagnostic.runtimePermissionStatus.GRANTED:
console.log("Permission granted (or already granted) - call the plugin");
// call SQLite plugin
break;
case cordova.plugins.diagnostic.runtimePermissionStatus.DENIED:
console.log("Permission denied - ask again");
alert("Come on user, we really need this. I'll ask again...");
requestPermission();
break;
case cordova.plugins.diagnostic.runtimePermissionStatus.DENIED_ALWAYS:
console.log("Permission permanently denied");
alert("Well that's it, we're dead Jim");
navigator.app.exitApp();
break;
}
}, function(error){
console.error("The following error occurred: "+error);
}, cordova.plugins.diagnostic.runtimePermission.READ_PHONE_STATE);
}
requestPermission();
Simply update your cordova-android version to 7.1.4 and it will works with targetSdkVersion > 22.
Here is the related issue on github: https://github.com/apache/cordova-android/issues/606

Google Play shows wrong minSdkVersion for Android app

I added android:minSdkVersion="14 to the manifest of my Android app to only allow Android 4+ devices but Google Play shows that my app Requires Android 1.6 and up. Is there anything wrong with my manifest?
<android>
<manifestAdditions>
<![CDATA[
<manifest android:installLocation="auto">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.android.vending.BILLING" />
</manifest>]]>
</manifestAdditions>
</android>
I used the Adobe AIR SDK 17 and packaged the app through ADT (command line).
It's a bug on Google Play! (it affects Beta and Alpha apps - I guess your app is in that state?) Check your APK details in the Developer Console for the API level - as long as it's correct your set. It should show the correct API level as soon as you publish the app to production.

“your device isn't compatible with this version”

I have an app on the google play app store for more than two years with more than 8000 download and its a paid app. recently i received a mail from one of the customers saying that he had been using the app over two years and recently he updated his devices with latest os versions
after which he is not able to install the app from the app store. No updates have been pushed from developer end. the customer gets the error " your device is not compatible with this version" but the app is of the
same version that he had been using. what could be the error. any suggestion pls
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="au.example.test"
android:installLocation="auto"
android:versionCode="12"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<supports-screens android:largeScreens="true" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
In AndroidManifest.xml you can specify the minimum and maximum sdk version in this form:
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
Change your maxSdkVersion to the latest android sdk version(18), then it should work
This may or not make a difference but it is recommended that you target a particular API level. It may be worth setting the target sdk version to the latest android release and ensure it is working as expected.

Android application incompatible with many phones

I wrote an application for Android and now one of the users reports that the application is incompatible with many phones. I think the requirements/permissions are not that exotic.
My manifest file has following code:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:anyDensity="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.VIBRATE"/>
Incompatible phones are shown in gray:
Market http://www.preston.be/market.png
Anyone an idea what's missing/wrong?
according to
android:minSdkVersion="3" android:maxSdkVersion="4"
you are supporting only devices with Android 1.5 and 1.6
most of the devices have a newer OS version like froyo 2.2
install the latest SDK then in your android proyect go to "Properties" -> "Android" and change the "Project Build Target", for example Android 2.2 , API level 8.
then change in your AndroidManifest.xml
android:minSdkVersion="3" android:maxSdkVersion="8"
then your app will be able to support more devices...
The problem is that with the SDK versions you're using, there's an implied CALL_PHONE permission (see here and here for more detailed explanations). You should be able to work around this by changing the targetSdkVersion as shown in the second link.
Here lies the problem <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>.
You are targeting Android 1.6 handsets, there are less than 15 % handsets out there that have that version of Android. You should target the latest Android versions. Here is Android docs about api levels that will make this more useful for you.
Also read up what it says about versions here.
As #commonsware mentioned below, I misunderstood, this. My apologies.

Categories

Resources