I have just downloaded the latest SDK version from Android SDK Manager and set my App's Project Build Target to Google APIs level 17 as below
And added in my App's AndroidManifest.xml as below
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="17"
android:maxSdkVersion="17" />
And loaded the Emulator with Level 8, 2.2 then tried to launch the App on this Emulator. Whenever I run the app it says "No compatible targets were found" (I know I can create AVD for level 17 but want to launch on emulator level 8) when I have android:minSdkVersion="3" in my AndroidManifest.xml.
I researched a lot and did not find a proper answer to this.
Then I changed the Project Build Target to Android 4.2 level 17 as below
The App started launching on all the Emulators below level 17.
But I still don't know what is restricting the App to launch on lower version Emulator when the Project Build Target is to Google APIs level 17
Google APIs Add-On is an extension to the Android SDK development environment that lets you develop applications for devices that include Google's set of custom applications, libraries, and services. A central feature of the add-on is the Maps external library, which lets you add powerful mapping capabilities to your Android application.
Enabling Google APIs lets you use features that are not present in default Android devices. Since your minSdkVersion is set to 3, you should be able to launch the application if you create an emulator with API version greater than 3 but with Google APIs enabled.
Just remove the targetSDKVersion attribute and then try.
An integer designating the API Level that the application is targetting.
With this attribute set, the application says that it is able to run on older versions (down to minSdkVersion), but was explicitly tested to work with the version specified here. Specifying this target version allows the platform to disable compatibility settings that are not required for the target version (which may otherwise be turned on in order to maintain forward-compatibility) or enable newer features that are not available to older applications. This does not mean that you can program different features for different versions of the platform—it simply informs the platform that you have tested against the target version and the platform should not perform any extra work to maintain forward-compatibility with the target version.
https://stackoverflow.com/a/4568358/760489
try removing android:maxSdkVersion
Related
I am an experienced Android developer using Eclipse, but one thing still mystifies me. Namely SDK version specifications. In particular, I find several places where SDK versions are specified:
Project Properties: Android: Project Build Target
Manifest: minSdkVersion
Manifest: targetSdkVersion
Manifest: maxSdkVersion
Below are my guesses about usage (probably wrong):
Project Properties: Project Build Type
Ok, seems fairly straightforward. I believe this specifies the API "library" to use.
Manifest: minSdkVersion
My guess is that this is the minimum level (as specified above) for checking methods used. Ok, but seems redundant. Wouldn't the compiler just bark at me if I used an unsupported method?
Manifest: targetSdkVersion
Can't figure this one out. If I call only supported methods, what additionally does this setting do?
Manifest: maxSdkVersion
Even more mysterious. Why would you ever want to limit the max version? Aren't they backward compatible?
The official doc is rather sparse on the functionality of these settings. Can anybody give me some insight?
Android: Project Build Target
When you select a project build target version it means you are apk or classes will be compiled according to selected SDK. for ex - if you select project build target 16 and try to use annotation #JavaScriptInterface it will not find because this annotation is available in above that target.
Manifest: minSdkVersion
If you define minimum SDK version, an Android users who are using below the specified minimum SDK version can't use your app.
For more info from google Docs:
An integer designating the minimum API Level required for the
application to run. The Android system will prevent the user from
installing the application if the system's API Level is lower than the
value specified in this attribute. You should always declare this
attribute.
Manifest: targetSdkVersion
The targetSdkVersion has nothing to do with how your app is compiled or what APIs you can utilize. The targetSdkVersion is supposed to indicate that you have tested your app on (presumably up to and including) the version you specify. This is more like a certification or sign off you are giving the Android OS as a hint to how it should handle your app in terms of OS features.
For example, as the documentation states:
For example, setting this value to "11" or higher allows the system to
apply a new default theme (Holo) to your app when running on Android
3.0 or higher...
The Android OS, at runtime, may change how your app is stylized or otherwise executed in the context of the OS based on this value. There are a few other known examples that are influenced by this value and that list is likely to only increase over time.
For all practical purposes, most apps are going to want to set targetSdkVersion to the latest released version of the API. This will ensure your app looks as good as possible on the most recent Android devices. If you do not specify the targetSdkVersion, it defaults to the minSdkVersion.
Manifest: maxSdkVersion
If you define maxSdkVersion users who are using an android phone running SDK version more than what you defined in maxSdkVersion can't use your app.
For more info from google Docs:
An application declaring maxSdkVersion="5" in its manifest is
published on Google Play. A user whose device is running Android 1.6
(API Level 4) downloads and installs the app. After a few weeks, the
user receives an over-the-air system update to Android 2.0 (API Level
5). After the update is installed, the system checks the application's
maxSdkVersion and successfully re-validates it. The application
functions as normal. However, sometime later, the device receives
another system update, this time to Android 2.0.1 (API Level 6). After
the update, the system can no longer re-validate the application
because the system's own API Level (6) is now higher than the maximum
supported by the application (5). The system prevents the application
from being visible to the user, in effect removing it from the device.
Project Properties: Project Build Type - Yes this will pick up the android.jar and also the build tools version.
Manifest: minSdkVersion - This is not just for the compilation purpose but also used by google play to filter the application.
Secondly, if you have any functionality which is not available below a certain version but required by your application.
Manifest: targetSdkVersion - As Android evolves with each new version, some behaviors and even appearances might change. However, if the API level of the platform is higher than the version declared by your app's targetSdkVersion, the system may enable compatibility behaviors to ensure that your app continues to work the way you expect. You can disable such compatibility behaviors by specifying targetSdkVersion to match the API level of the platform on which it's running. For example, setting this value to "11" or higher allows the system to apply a new default theme (Holo) to your app when running on Android 3.0 or higher and also disables screen compatibility mode when running on larger screens (because support for API level 11 implicitly supports larger screens).
Manifest: maxSdkVersion - not recommended. This will restrict your app onto any version higher that the specified maxSdkVersion.
In Android 1.5, 1.6, 2.0, and 2.0.1, the system checks the value of this attribute when installing an application and when re-validating the application after a system update.
However, future versions of Android (beyond Android 2.0.1) will no longer check or enforce the maxSdkVersion attribute during installation or re-validation
There is no need to set the attribute as means of blocking deployment of your application onto new versions of the Android platform as they are released. By design, new versions of the platform are fully backward-compatible. Your application should work properly on new versions, provided it uses only standard APIs and follows development best practices. Second, note that in some cases, declaring the attribute can result in your application being removed from users' devices after a system update to a higher API Level. Most devices on which your application is likely to be installed will receive periodic system updates over the air, so you should consider their effect on your application before setting this attribute.
https://developer.android.com/guide/topics/manifest/uses-sdk-element.html covers it all
I have already updated an app to playstore with below-mentioned uses-SDK:
<uses-sdk
android:maxSdkVersion="23"
android:minSdkVersion="17"
android:targetSdkVersion="23"/>
I want to downgrade my targetSdkVersion "23" to "22". I've done it. if I upload to playstore, will the update work for all the users properly?
You won't have any problem at all. What you are saying with your <uses-sdk> is that your app is fully tested to run in version 22 and can even run in lower versions until 17.
I suggest you to take a look to this documentation ver carefully.
android:targetSdkVersion
An integer designating the API Level that the application targets. If
not set, the default value equals that given to minSdkVersion. This
attribute informs the system that you have tested against the target
version and the system should not enable any compatibility behaviors
to maintain your app's forward-compatibility with the target version.
The application is still able to run on older versions (down to
minSdkVersion).
As Android evolves with each new version, some behaviors and even
appearances might change. However, if the API level of the platform is
higher than the version declared by your app's targetSdkVersion, the
system may enable compatibility behaviors to ensure that your app
continues to work the way you expect. You can disable such
compatibility behaviors by specifying targetSdkVersion to match the
API level of the platform on which it's running. For example, setting
this value to "11" or higher allows the system to apply a new default
theme (Holo) to your app when running on Android 3.0 or higher and
also disables screen compatibility mode when running on larger screens
(because support for API level 11 implicitly supports larger screens).
There are many compatibility behaviors that the system may enable
based on the value you set for this attribute. Several of these
behaviors are described by the corresponding platform versions in the
Build.VERSION_CODES reference.
To maintain your application along with each Android release, you
should increase the value of this attribute to match the latest API
level, then thoroughly test your application on the corresponding
platform version.
NO. You'll not be able to update your app by changing target SDK from
23 to 22.
PROBLEM
Users that have the APK with version code 6, which targets SDK 23 or higher, will receive an error when they attempt to upgrade to this APK because it targets SDK 22.
Now, as you all know, when we keep target SDK to <23, while installing the app by default all the permissions are granted for the app and if we keep target SDK 23 or higher, all the permissions are set to OFF while installing the app.
RESOLUTION
Ensure that your release including APKs targeting SDK 23 or higher to which all users that have the APK with version code 6 can upgrade.
If you didn't change the code(except the gradle file) and the app still works on the '23' version emulator then there shouldn't be any problem.
It really depends on which features(classes and methods) you used in your code.
If you didn't use any of Android 6's features in your code, then there shouldn't be any problem downgrading the target sdk version without having any change for android 6 users.
I have been working on an Android project from past one year in Eclipse with API level set to 4.2 (target SDK 17).
Now I want to publish it in the Play Store. Should I change the target SDK (manifest file) to the latest (i.e. 4.4) since my app works perfectly on KitKat?
The purpose of targetSdkVersion is explained in the developer documentation for <uses-sdk>:
This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version. The application is still able to run on older versions (down to minSdkVersion).
As Android evolves with each new version, some behaviors and even appearances might change. However, if the API level of the platform is higher than the version declared by your app's targetSdkVersion, the system may enable compatibility behaviors to ensure that your app continues to work the way you expect.
TL;DR: You should set targetSdkVersion to the API level that you've primarily been developing and testing on. Google recommends that you see to it that this is the latest Android version, but that may not always be feasible (for financial and other reasons).
See your app will work fine with kitkat because the newer versions are always made to be compatible with the older android versions,but vice versa is not true....if you develop something in higher API level and then try to run it in older versions of android, than it may happen that your app may not work or some features may not work as expected.So,you too can add KITKAT compatibility in your android manifest file ...cheers
As per this announcement you have to make sure to use a recent target SDK (at most one or two versions older than the most recent), otherwise you cannot publish your app in the Play Store. This is enforced for new apps as of August 2018 and November 2018 for updating existing apps, requiring you to target API level 26 or newer.
I experience this problem when I added another project from internet. I think it asks me to use another version of target android. But I want that my app will work in android 2.2.
But it doesn't require API-8, it requires API-16 and I m not sure what I should do.
Modify the AndroidManifest.xml file so that any versions in there are Android 2.2. Also change the version of the SDK used by right clicking the project in eclipse and go to properties->android and change the version to 2.2. Some things might break though. Usually the version declared in the manifest is declared because the project uses SDK features only available for that version or later.
Your app will still work on older versions even if you are targeting newer version. The target is what version you have tested your app to work on. If you target the most recent version (API 16), then your app will not be put in 'compatibility mode' when running on older phones. For example, if you have a menu button in 2.x but you target API 16, this menu button will not show up on certain phones since you're supposed to be using the ActionBar.
The minSdkVersion is what you are thinking of, which will make sure your app runs on older versions:
<uses-sdk android:minSdkVersion="8" />
So the solution to your problem is just to download the newest API level through the SDK Manager. You most likely just don't have API 16 installed.
I would like to know if phones with Android 2.3 or lower could download Apps with:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
and Build Target 15?
Becuase I have to do so to use the AdMob jar.
Thanks
Yes they can, this is the goal of the android:minSdkVersion attribute. It prevents users with an older android version to download and install the app.
Yes, any device running SDK version 7 and above will be able to install your application. The targetSdkVersion attribute doesn't restrict devices from installing your application. Instead, it specifies the maximum API level on which your application should be able to run on.
Just be careful that you protect earlier versions of Android from making use of the new methods provided in SDK 15, as this will cause your application to crash.