Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio minSdkVersion not working

Tags:

android

gradle

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!

like image 884
Bill Avatar asked Jul 16 '14 01:07

Bill


People also ask

How do I change sdk to minSdkVersion?

To change Android minSdkVersion in Flutter for the project created after the 2.8 update, you have to make changes in the local. properties file and then reference the new variable from the local. properties file inside the build. gradle file.

What is minSdkVersion and targetSdkVersion?

android:minSdkVersion — Specifies the minimum API Level on which the application is able to run. The default value is "1". android:targetSdkVersion — Specifies the API Level on which the application is designed to run.


1 Answers

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.

like image 61
papercut Avatar answered Sep 19 '22 15:09

papercut