A bit of a silly question, but I am trying to play around with supporting different Android API levels and created a simple application which has the following SDK version settings:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
I have a device to test on which has the latest version installed, but when I am trying to create AVD with lower version API I can't choose any other option apart from the latest one (18) as nothing is available in the list. I've tried a variety os sample devices with no luck. How can I create an AVD with API level 8 or 10?
Download that sdk level and emulators for the level from the Android SDK manager. If the sdk is set up properly, simply type android in the command prompt and it should show up.
Download:
Sdk platform
System image
for API you want to use from Android SDK manager.
Related
How to change API level. when selecting this API level it shows no CPU/ABi available and also I am not able to add text fields it throws an exception.
Image 1Image 2
In Eclipse go to manifest.xml
<uses-sdk android:minSdkVersion="int" />
In android studio: go to your app Gradle there you can find the minSdkVersion. Lower it to the version you needed.
android {
....
defaultConfig {
....
minSdkVersion 17
....
}
}
Quick Fix: Uncheck installed checkbox to see other downloads and try to refresh android sdk manager, restart it or restart the computer. API 19 worked fine for me before I moved to android studio.
I'm not sure if API 20 is supported in eclipse, I recommend Android Studio for android development. Anyway, if you have an old PC that does not meet android studio minimum requirement, download IntelliJ IDEA https://www.jetbrains.com/idea/, it's a bit lighter and free and require 1 GB of RAM (But 1 GB is very bad, you need at least 2 GB without running android emulator). However, if you still want to work with eclipse I think you need API 19 you have to download it manually from the web and move it to android SDK location. Or you can install android studio to download SDK without using it.
Newer APIs are way better, they have more libraries that supports both old and new android versions. It's really worth upgrading to Android Studio.
For the CPU/ABi error check this post Android 4.3 Virtual Device CPU/ABI - No system images installed (eclipse)
I have completed the basics of android application using eclipse. I am now trying to create games using the ANDengine which I'm sure I have done correctly.
To make sure I'm on the right track, I downloaded examples and tried to run them on my tablet. After importing the sample code, I received an error "cannot resolve target android-15" which I solved by installing SDK 4.0.3 which had the Api level 15. I downloaded the bundle with sdk 4.4 and api level 19. I would have thought level 19 would be sufficient but I downloaded it anyway.
I downloaded a second example and it now cannot resolve "android-8" which I'm assuming is going to require another SDK.
How does the api levels work? Am I required to install all of the SDK versions?
The SDKs themselves are not downwards compatible. If it say in your AndroidManifest.xml that the target SDK version is 15, you'll need exactly that version to compile the project.
Anyway, the code itself is upwards compatible. Just open your AndroidManifest.xml and look for something like that:
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15" />
Change it to
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="19" />
and you can compile with API level 19.
I do not know about AndEngine, but for using different API levels in your code, you need to download the required files for each platform using SDK manager. You can check in $SDK_ROOT/platforms folder which API levels are already downloaded on your machine. You need to download each API-level, before using them in your project. Downloading the highest one is not enough.
And yeah you need to download the version which you're going to target i.e. the version which is going to be used to compile the project (targetSdkVersion), not the one you want to use as minimum api level (minSdkVersion)
My application targets API 17 but the min Sdk version is the 8. In the layout design preview page I can se how my layout appears on an API 17 version, but if I click on the API selector drop down menu, I can't choose any other API level.
Obviousely I can run my application in a 2.3 Android version and on a real device I can see the result, but is there a way to test in also in the design preview page?
My manifest snippet:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
UPDATE
Actually I found out what the problem was:
when you install Android Studio, by default it uses its own Android SDK (located in the Android Studio.app/sdk folder), instead of the ones you downloaded (for example to use with Eclipse).
So I simply had a misalignement between the SDK I thought I was using and the ones I was actually using. To solve this you have 2 options:
-from Android Studio select File -> Project Structure. Under "platform settings" you can add your (updated) downloaded SDK folder and use it for your projects.
-open the Android Studio SDK manager and install also the older android versions SDKs
It seems like 17 is the only available API level for preview at the moment.
I have all the SDKs installed correctly and it appears the same as yours.
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.
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.