6

The minSdkVersion directive in my build.gradle appears not to be working (Android Studio 0.8.2)

Here's the build.gradle for the "mobile" module:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    wearApp project(':wear')
    compile 'com.android.support:appcompat-v7:20.+'
    compile 'com.google.android.gms:play-services-wearable:+'
}

When I try to debug it on my Samsung Galaxy S4 (API 19) I see this message in the "Compatible" column:

"No, minSdk(API 20) > deviceSdk(API 19)"

Minimum SDK should clearly be 9 as specified by the build.gradle. If I try to launch it anyway I get:

"Failure [INSTALL_FAILED_OLDER_SDK]"

I've scoured this project for any indication of something that could force the minSdk to 20. Nothing in AndroidManifest.xml. This project is a wearable app.

I've built another wearable app on the same machine and it loads and runs on the Samsung without a problem. This app that I'm trying to use was put together by a friend. It has only a small amount of code. The build.gradles are identical.

Totally baffled. Please help!

4
  • Did you override minSdkVersion in one of your build types or flavors? It might help if you post your full build.gradle. Commented Jul 16, 2014 at 1:28
  • 2
    "This project is a wearable app." That's your problem. Google Wear requires a minSdkVersion of 20. Commented Jul 16, 2014 at 1:29
  • Edited to show the full gradle. To clarify this is the build.gradle of the "mobile" portion of the app, not the "wear" portion. The wear portion does require minSdk 20 but the mobile portion should not (and does not in another app using the same IDE and devices). Commented Jul 16, 2014 at 1:53
  • I'm seeing a lot of similar posts now including one that pointed to this "reddit.com/r/androiddev/comments/297xli/…> but that did not work for me. I'm not sure what the entire list of support lib dependencies should be. I suspect my app has some material design dependency that is causing minSdk to be forced to 20. Commented Jul 16, 2014 at 22:21

2 Answers 2

1

Android L version (SDK 20) will be overrides minSdkVersion to 20. You should change your build version to 19 or below version of SDK. for example,

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'

    defaultConfig {
        applicationId "example.myapplication"
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                         'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:19.+'
}

Modify your build.gradle file like this, and resync your project and rebuild it. also you should install 19.1 sdk libraries to using SDK Managers. Run android studio as administrator will be help to solve another problems when you install sdk and rebuild your project.

Sign up to request clarification or add additional context in comments.

Comments

0

you can change compileSdkVersion 20 to compileSdkVersion 16 to have a try ,it works to me

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.