dckuehn
dckuehn

Reputation: 2475

Cannot downgrade Android minimum sdk

I have just created my first android app (for the um-teenth time). I created the project with a higher sdk than I intended, and now I want to lower it. My initial android maifest did not contain a <uses-sdk>section, so I added:

<uses-sdk
    android:minSdkVersion="17"
    android:targetSdkVersion="17"
    android:maxSdkVersion="21" />

I also updated my build.gradle file to (relevant section):

 defaultConfig {
    applicationId "dkuehn.myapp.myapp"
    minSdkVersion 17
    targetSdkVersion 17
    versionCode 1
    versionName "1.0"
 }

However, after syncrhonizing my app, and attempting to run, my AVD screen looks like this: enter image description here

So neither my s5 plugged via USB running what I believe is 4.2.2 and the emulator that is minimum SDK (assuming 21 is in fact above 20 L) are compatabile. But I still want to lower the minimum sdk so I can use my phone and not rely on emulators for now.

The AndroidManifest in the /build/ folder looks like this:

<uses-sdk
    android:maxSdkVersion="21"
    android:minSdkVersion="L"
    android:targetSdkVersion="L" />

Update: my compile options within build.gradle My dependency options for build.gradle are:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    //compile 'com.google.android.gms:play-services:4.2.42'
    //compile 'com.android.support:appcompat-v7:21.+'
}

Upvotes: 1

Views: 910

Answers (1)

ianhanniballake
ianhanniballake

Reputation: 200130

You're using the Developer Preview versions of some dependencies, which enforce a strict 'L' min and target SDK.

Look for dependencies such as

compile 'com.android.support:appcompat-v7:21.0.0-rc1'

And replace them with the now released Android Lollipop versions (which allow them to be used from their min SDK to API21 devices):

compile 'com.android.support:appcompat-v7:21.0.0'

Upvotes: 1

Related Questions