What is android api level of my project - android

If the minSdkVersion of my project is 11 then what is the api level of my project? I mean how
to check whether I am working in api version 2, 3 or above? thanks.

You can actually keep the project's targetSDK at the same level, and just use a minSDK value.
What this means is that your application will target to build against a certain API, but it will let phones with lesser versions of Android than that API to also run the app. The catch is that you have to make sure you don't make any API calls that don't exist in the older versions of Android.
To change this, go to your AndroidManifest.xml and add the following inside of the xml node:
<uses-sdk android:minSdkVersion="3" />
This would set your minsdk to Android 1.5. Change it 4 for Android 1.6 and so on.
But if you really want to change the TargetSDK, right click on your project --> properties. Then click the Android tab on the left. Then check the box of the target API you want to build against.
List of api level is here and example is here

The minSdkVersion attribute only specifies the lowest API level on which your application will run.
If you did not set targetSdk or maxSdkVersion, then your app will run on the api level of the android device (if it is above or equal of minSdkVersion).
See http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

1) Right Click On Project
2) Click on "Properties"
3) Select "Android" from left Tab

Check targetSdkVersion in AndroidManifest.xml.
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />

Related

How can I support API 16 but still have Leanback?

I made my game work on Android TV, it required Leanback library, which wants minSdkVersion to be 17. I must support API 16 too. What can I do?
When building, I get an error this suggestion:
Suggestion: use tools:overrideLibrary="android.support.v17.leanback" to force usage
What exactly does it do? Does it actually make my app still support API 16? What am I losing?
You can find the detailed information here.
Here is what it says:
tools:overrideLibrary marker
A special marker that can only be used with uses-sdk declaration to
override importing a library which minimum SDK version is more recent
than that application's minimum SDK version. Without such a marker,
the manifest merger will fail. The marker will allow users to select
which libraries can be imported ignoring the minimum SDK version.
And you need to do the following: In the main android manifest :
<uses-sdk android:targetSdkVersion="14" android:minSdkVersion="2"
tools:overrideLibrary="android.support.v17.leanback"/>
Hope this helps.

v14 Layout File is not updating

I have developed an android app with minSdk = 10 now I want to add a Switch in one of the Activity (has the layout file with name content_main.xml).
As the Switch need the minSdk to be 14, I have updated the same in AndroidManifest and
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="20" />
But when I added the Switch on the xml, it still giving an error as the
View requires API level 14 (current min is 10)
Moreover Android Studio automatically created a duplicate layout file, one for the current sdk version and another for API level 14 and they are not being updated automatically, which creates a conflict in the UI.
Please do let me know, how to safely merge these two layout files to one to avoid the conflict. As I need a switch, how will use in this case (as the application does not seem to respond to Manifest file)
If using android Studio, you should look at your build.gradle and check minSdkVersion !

ADT project creating error

I would like to create a new project in ADT, but I can not do this, I always get similar messages to this:
This template requires a build target API version of at least 14, and
the current version is 10
I would like to use Android 2.3.3 to build.
Make sure you have updated the SDK manager upto the recent API level and you can set minSDK version to 10 and target SDKVersion as 14..Also set Theme as None because you are probably using a HoloTheme...
This template requires a build target API version of at least 14, and the current version is 10
Here it is clearly saying that your trying to use a template which requires minimum of API level 14 but you mentioned API level 10 as in your manifest file. So go to Android manifest file and change target SDK version to 14
like:
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="14" />

How to combine two projects made under different API level?

I m creating a customised music player with some additional features in it.... for that i copied one project whose API level is 10 and pasted it in my current working project whose API level is 19..... i m getting an error "Using 1.7 requires compiling with Android 4.4 (KitKat); currently using API 10"...... I don't know how to make two API level work in the same project ..... please help....... i tried cleaning my project and rebuilding it ..... but after that it shows R cannot be resolved to a variable
Try changing the api level on the project, in your project manifest you will find this line:
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
Change the targetSdkVersion to 19 to make it work with Android 4.4.

Why doesn't the android SDK warn me about backward compatibility issues?

I set my minimum API version to 8, but the android SDK fails to warn me when I use functions that were added in API 14. Why is that?
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
Right click on your project -> Android tools -> Run Lint.
The Lint tool will warn you. It also checks for incompleteness in your strings file etc.
It's your minimum supported level, not minimum required. It's reasonable to want to support up to the latest API (or API 14 for example) and gracefully degrade certain features all the way down to API 8. You can include functionality from API levels higher than your minimum, and simply check the version code at run time, and go down different code paths as necessary.
Please check you project target,
Right click on project--> property --> android --> API 8 --> apply --> ok
Then clean and refresh the project, your problem will be solve..:)

Categories

Resources