Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In IntelliJ, how to set the Android API level

I'm using the latest and greatest IntelliJ Community edition. My application runs fine on the android emulator. However, I need the emulator to better match the Kindle Fire. I made the configuration changes in the AVD Manager (including setting device to API 10.)

When I went to my project to configure the project to target the new virtual device, I got the following message: "Build target of AVD DEV3 is not compatible with your build target."

It didn't take much work to figure out that the issue is related to my choice of API 10.

I don't know where I tell my project to use API 10. I looked all over and didn't see any references to the API level at all. Any ideas?

EDIT

I added

<uses-sdk android:minSdkVersion="10" />

to my AndroidManifest.xml file and was able to select the new device. I'm starting it up now.

like image 437
Tony Ennis Avatar asked Apr 29 '12 17:04

Tony Ennis


2 Answers

The answer above is no longer true in Intellij (using gradle)

Now <uses-sdk> is ignored in the AndroidManifest.xml, it is automatically added to the built manifest file. To change the version, go to the 'build.gradle' file and look at the minSdkVersion.

like image 121
David Ljung Madison Stellar Avatar answered Oct 30 '22 09:10

David Ljung Madison Stellar


As Tony and Blundell mention, the answer is to declare your minSdkVersion in your AndroidManifest.xml file. In this way, the application will be allowed to launch on any AVDs that at least meet the minSdkVersion.

Here's more documentation on the <uses-sdk> tag: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

like image 34
James Avatar answered Oct 30 '22 07:10

James