Tony Ennis
Tony Ennis

Reputation: 12299

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.

Upvotes: 8

Views: 10609

Answers (3)

smac2020
smac2020

Reputation: 10734

Set this value in the Gradle file - as shown here:

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.example.kotlinconverterapp"
        **minSdkVersion 26**
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

Upvotes: 0

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.

Upvotes: 4

James
James

Reputation: 710

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

Upvotes: 2

Related Questions