Android Studio : Failure [INSTALL_FAILED_OLDER_SDK]

后端 未结 24 1226
孤街浪徒
孤街浪徒 2020-11-27 04:54

Today I have downloaded Android Studio v 0.8.0 beta. I am trying to test my app on SDK 17 . Android studio error Failure [INSTALL_FAILED_OLDER_SDK] Here is my a

相关标签:
24条回答
  • 2020-11-27 05:20

    Another way to support Android L is to use custom lpreview property for Gradle. For instance:

    lpreview = hasProperty('lpreview')
    
    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion lpreview ? "android-L" : 19
        buildToolsVersion "20.0.0"
    
        productFlavors { lpreview ? lpreview{} : classic{} }
    
        defaultConfig lpreview ? {} : {
            minSdkVersion 14
            targetSdkVersion 19
        }
    

    Now, you can build your app with:

    ./gradlew clean
    ./gradlew -Plpreview assembleDebug
    

    or

    ./gradlew -Plpreview installLpreviewDebug
    

    This way you can build your app with lpreview property for Android L and without it for previous versions.

    0 讨论(0)
  • 2020-11-27 05:21

    The real issue is that with vanilla Android Studio v 0.8 beta, it only installs/recognize SDK 20 which is android L. In order to target another complieSDK you need to install it via the SDK manager. Once it is set, you can then change the compileSDK to a lower version and it should work.

    you may also want to restrict the compatibility library, it needs to be restricted from using the latest version of the library so change the dependecy to something like :

    compile('com.android.support:appcompat-v7:19.1.0') {
        // really use 19.1.0 even if something else resolves higher
        force = true
    }
    
    0 讨论(0)
  • 2020-11-27 05:21

    your device older than minSDK , edit minSdkVersion in build.gradle

    0 讨论(0)
  • 2020-11-27 05:22
    <uses-sdk android:minSdkVersion="19"/>
    

    In AndroidManifest.xml worked for me on Android Studio(Beta)0.8.2.

    0 讨论(0)
  • 2020-11-27 05:23

    I ran into the same issue and solved it by downloading api level 20 using sdk manager and changing every string that points to android-L. I did it because I dont have a kitkat device and don't want to use emulator. See the image download the marked one.

    Here's my build config:

    apply plugin: 'com.android.application'
    
    android {
    compileSdkVersion 20//changed this from default
    buildToolsVersion "20.0.0"
    
    defaultConfig {
        applicationId "com.example.subash.test"
        minSdkVersion 12//changed this from default
        targetSdkVersion 20//changed this from default
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
    }
    
    0 讨论(0)
  • 2020-11-27 05:24

    Do those changes in build.gradle file in the wear module

    compileSdkVersion 20
    targetSdkVersion 20
    

    So the final wear/build.gradle content will be:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 20
        buildToolsVersion "20.0.0"
    
        defaultConfig {
            applicationId "your package name"
            minSdkVersion 20
            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'])
        compile 'com.google.android.support:wearable:+'
        compile 'com.google.android.gms:play-services-wearable:+'
    }
    
    0 讨论(0)
提交回复
热议问题