how to run android app in lower api target emulator? - android

I had made an application with target : Android 2.1 - API Level7. It works fine with the emulator with target : Android 2.1 - API level7. And after that i tried to run the same app in an emulator with target : Android 1.5 - API Level3. But it is not working. I am using the Eclipse to built my application..
Can anyone say why it happens like this? Or, can anyone simply describe how to make changes to run an app build in API Level7 to 5 with steps.. I am new to this environment, i may be wrong with my procedures..
So plz guide me..

Use the min sdk version in your manifest file to Android 1.5 api level 3. Your api target version is still the same.
Add the following line in your AndroidManifest.xml file
<uses-sdk android:minSdkVersion="3" />
this will allow your app to run in any device with api level 1.5 or higher.

Set the minSDK to the lowest level you want to support, and the max to the highest level. The set the target to whichever makes sense.
In summary, look at this: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html.
You choose the min, target and max SDK in the manifest file.

android is backwards compatible, not forwards, so your target api should be the lowest version of android ynu would like your app to run on. your target api should be 1.5.

Yes as everyone said. Android minimum-sdk-version is trick for you question.
If you have target API 2.3.3 then minimum-sdk-version will be 10(By default).so it will run on 2.3.3, 3.1,3.3 and more which has minimum-sdk-version more than 10.
So if i change minimum-sdk-version to 4 it will work on device which have version more than 4.
No you have two solution --
1) change minimum-sdk-version in android-manifest
2) change target api
project->rightclick->properties->android then select Target API

Related

Android SDK - What to download?

I want to develop android applications, i've downloaded all the necessary.
One last question:
if i decided to create apps that are compatible with for example starting from API 11 and later, what is the strict necessary i need to download from Androis SDK Manager?
I need to download all?
What are Android SDK build-tools?
What are other downloads in the list?
Can someone post a screenshot of strict necessary scenario to do what i'm need?
thank you
You don't need to download all Android SDK, just get Android 3.0 (API 11) and Android 5.0 (API 21) and declare the min and max targetsdk in the manifest file.
you have to declare your desire version using this line
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
in manifest file. for more info check this out http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
EDIT
you don't have to download anything for make strict versioning.
android:minSdkVersion
Like the name suggests, defines the minimum API level your application works on. This is used by Play Store to detect if the application is compatible with the users device. So, if your minSdkVersion is 7, Play Storewill show the application to devices from API level 7 (2.1) and up. This attribute should be set by all apps!
android:maxSdkVersion
This defines the maximum API level your application works on. Again, Play Store uses this to detect if an application is compatible with a device. Please note, that there in most cases is no reason to use this! it is perfectly possible to create a single APK which works on every API level from your minSdkVersion and up!
android:targetSdkVersion
Unlike the other two attributes, this is used by the Android platform itself. This attribute should be set to the maximum API level you tested your application on. If not set, this will default to your minSdkVersion.
you can also visit this to get more details http://simonvt.net/2012/02/07/what-api-level-should-i-target/

if i use android 4.1.2 (API 16) Android SDK will my apps work on Android 2.3

if i use android 4.1.2 (API 16) Android SDK will my apps work on Android 2.3 phones. i have downloaded android 4.1.2 sdk tools and other packages.
You will need to set the minimum SDK attribute in your manifest to 2.3 to ensure you app will work on earlier versions of the OS.
Your app will work fine, assuming you are not using any API calls from a later version.
The Android Dev team suggests you always compile against the newest version you can support. So, you are on the right track.
So bottom line, you are on the right track, just make sure to test your app against a 2.3.3 version of the emulator to ensure you are not using any un-supported API calls.
No, if your minimum sdk version is 16 it wont work on that android version.
if you want it to work on that specific version then set the minimum sdk version to 9. You can change this in the apps manifest file.
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="21"
/>
If you are getting errors probably saying "This code uses the minimum sdk to be api 16 or higher"
find alternate ways to modify the code for older android phones. If that does not work then dont support old version of android maybe.

Is there a way to change a project from using API 12 to API 8

I set up my project to use Android 3.2 (API Level 12), but it seems like a lot of phones are still using Android 2.2 (API Level 8).
Is there a way to change my project from only supporting Android 3.2+ to supporting back to Android 2.2?
yes...just change the minsdk number in the manifest. You have to be sure that you don't use any feature that is not supported though...
in your AndroidManifest.xml add this line:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" />
android:minSdkVersion tells the Store what the minimum version you are targeting is. In this case 2.2. Devices less than 2.2 won't be able to download your app.
android:targetSdkVersion tells the store what the best version you are developing for is. In this case 4.1. Devices over 4.1 can still download your app but certain features may run in compatibility mode.
NOTE: When you setup your project to use 3.2, all you did was select the Android SDK you wanted your IDE to use when checking and compiling your code. Without the uses-sdk line in your manifest you've targeted nothing.
Right Click Project -> Properties -> Android -> Select SDK version
Update Manifest, min/target api. (as others have described by others).
Go to your Manifest.xml file and edit the minSdkVersion to 4. That will set it way back to 1.5 or something like that :). You can make that number higher if you want to suit a higher API, but I like compatibility.

Build Target and Min SDK version in Android

While creating an android project if i say that the Build Target of my Android porject is 2.2 (API Level is picked as 8) and in the text box for Min SDK version. If i put some value apart from the API level (smaller or greater than 8) of the build target then what happens?
Does the build happen according to the build target specified, but the application developed is compatible with the smaller android versions (if i specify API level < 8 ). Or the application developed is only compatible for the higher android version (if i specify API level > 8 ).
Can anyone please explain?
There is a similiar question already posted with an excellent answer:
Read the post by Steve H.
Android Min SDK Version vs. Target SDK Version
Say you set the manifest API level to 4, then the app will work on any api 4 device provided. BUT the project will be built to API level 8 so if you have any post-level 4 api methods in your code then the app will crash.
You can only put min SDK version less than your target version,it tell that your application can support to that min SDK version,but you should confirm that your application should run under min SDK version supported devices since the Build target versions may use new APIs which are available for that specific version and those APIs may not available in min SDK versions
ok.. if you have developed an application using particular sdk for instance Android 2.2 and your minSDKversion is < 8 then application is falsely declaring to android system that It can be installed in Android device having sdk version less than Android 2.2. In that case if application happens to install on Android 2.1 and if you re using API that are exculsiviely avaialbe in Android 2.2 platform and not on Android 2.1 then your application will crash on the device. if your minsdkversion > 8 then application won't get installed on the device having Android sdk 2.2 or lower version

Confused about Min SDK Version

I am referring to the http://developer.android.com/resources/tutorials/testing/activity_test.html regarding activity testing.
My avd is showing platform-2.3.3 api level-10.
In eclipse when i click on create new android project and select create project from existing source and then browse to the samples\android-8\Spinner it prefill the Min Sdk Version with 3 and when i select the target platform 2.3.3 api level 10 it shows following warning:
The API level for the selected SDK target does not match the Min SDK Version.
I have checked the spinner manifest file it contains
<uses-sdk android:minSdkVersion="3"/>
I have tried different combinations like changed the sample folder and changed the target but it shows the same warning.
I want to know how to rectify the warning so that my sample run?
Please help me on this
min sdk version can be lower than target sdk version.
see this link
The app uses level 10 sdk I guess and the minsdklevel specified is 3 that is the reason for the warning. This warning can be ignored.
You can run the app on any version of android with level >= 3 as long you dont use any api calls which where introduced in level 10.

Categories

Resources