简体   繁体   English

Android Studio:失败[INSTALL_FAILED_OLDER_SDK]

[英]Android Studio : Failure [INSTALL_FAILED_OLDER_SDK]

Today I have downloaded Android Studio v 0.8.0 beta. 今天我已经下载了Android Studio v 0.8.0 beta。 I am trying to test my app on SDK 17 . 我试图在SDK 17上测试我的应用程序。 Android studio error Failure [INSTALL_FAILED_OLDER_SDK] Here is my android manifest Android studio错误Failure [INSTALL_FAILED_OLDER_SDK]这是我的Android清单

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.vahe_muradyan.notes" >
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".Main_Activity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

It seems that android studio uses configurations in build.gradle.Here is build.gradle 似乎android studio在build.gradle中使用配置。这是build.gradle

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 'L'
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.vahe_muradyan.notes"
        minSdkVersion 8
        targetSdkVersion 'L'
        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:appcompat-v7:19.+'
}

There are my config to support L and old versions of android: 我的配置支持L和旧版本的android:

apply plugin: 'com.android.application'

android {
    buildToolsVersion "20.0.0"

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


    productFlavors {
        l {
            minSdkVersion 'android-L'
            targetSdkVersion 'android-L'
            compileSdkVersion 'android-L'
        }
        old {
            minSdkVersion 10
            targetSdkVersion 20
            //TODO comment second line if build is not compiles for "L"
            compileSdkVersion 20
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    lCompile 'com.android.support:appcompat-v7:21.+'
    oldCompile 'com.android.support:appcompat-v7:19.1.0'
}

As result you will have flavors: 结果你会有口味:

oldDebug
oldRelease
lDebug
lRelease

And can install your application on old versions of android. 并且可以在旧版本的android上安装您的应用程序。

Do those changes in build.gradle file in the wear module 在wear模块中的build.gradle文件中进行那些更改

compileSdkVersion 20
targetSdkVersion 20

So the final wear/build.gradle content will be: 所以最终的wear / build.gradle内容将是:

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:+'
}

I'm using Android Studio Beta version 0.8.1 and I have the same problem. 我正在使用Android Studio Beta版本0.8.1,我遇到了同样的问题。 I now I sold my problem by changing the AVD (I'm using Genymotion) to API 19. and here is my build.gradle file 我现在通过将AVD(我正在使用Genymotion)更改为API 19来解决我的问题。这是我的build.gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "com.example.daroath.actionbar"
        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'])
}

在此输入图像描述

Hope this help! 希望这有帮助!

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 . 我遇到了同样的问题并通过使用sdk管理器下载api level 20并更改指向android-L的每个字符串来解决它。 I did it because I dont have a kitkat device and don't want to use emulator. 我这样做是因为我没有kitkat设备而且不想使用模拟器。 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'])
}

As mentioned before switching to build 19 is the suggested route here until v20 is "fixed". 如前所述,切换到构建19之前是建议的路由,直到v20“固定”。 This thread helped me solve the issue, but it seems similar answers have been posted here as well. 这个帖子帮助我解决了这个问题,但似乎这里也发布了类似的答案。 https://code.google.com/p/android/issues/detail?id=72840 https://code.google.com/p/android/issues/detail?id=72840

Change file AndroidManifest.xml 更改文件AndroidManifest.xml

<uses-sdk android:minSdkVersion="19"/>
<uses-sdk android:minSdkVersion="14"/>
<uses-sdk android:minSdkVersion="19"/>

AndroidManifest.xml ,我在Android Studio(Beta)0.8.2上工作。

Failure [INSTALL_FAILED_OLDER_SDK] 失败[INSTALL_FAILED_OLDER_SDK]

basically means that the installation has failed due to the target location (AVD/Device) having an older SDK version than the targetSdkVersion specified in your app. 基本上意味着安装失败,因为目标位置(AVD / Device)的SDK版本比应用程序中指定的targetSdkVersion旧。

FROM

apply plugin: 'com.android.application'

android {

compileSdkVersion 'L' //Avoid String change to 20 without quotes
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.vahe_muradyan.notes"
    minSdkVersion 8
    targetSdkVersion 'L' //Set your correct Target which is 17 for Android 4.2.2
    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:appcompat-v7:19.+' // Avoid Generalization 
// can lead to dependencies issues remove +

}

TO

apply plugin: 'com.android.application'

android {
compileSdkVersion 20 
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.vahe_muradyan.notes"
    minSdkVersion 8
    targetSdkVersion 17
    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:appcompat-v7:19.0.0'
}

This is common error from eclipse to now Android Studio 0.8-.8.6 这是从eclipse到现在Android Studio 0.8-.8.6的常见错误

Things to avoid in Android Studio (As for now) Android Studio中要避免的事情(目前为止)

  • Avoid Strings instead set API level/Number 避免使用字符串来设置API级别/数字
  • Avoid generalizing dependencies + be specific 避免泛化依赖性+具体

在AndroidManifest.xml文件中将user-sdk更改为旧版本<uses-sdk android:minSdkVersion="19"/>

After a lot of research i found the solution for this huge error which i was struggling for 2 days. 经过大量的研究,我发现了这个巨大的错误的解决方案,我正在努力2天。

Instead of changing the minSdkVerison & targetSdkVersion in build.gradle 而不是在build.gradle中更改minSdkVerison和targetSdkVersion

Just open the Manifest file and use this 只需打开清单文件并使用它

&ltuses-sdk 
android:minSdkVersion="17" 
android:targetSdkVersion="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. 真正的问题是,使用vanilla Android Studio v 0.8 beta,它只安装/识别SDK 20,它是android L.为了定位另一个complieSDK,你需要通过SDK管理器安装它。 Once it is set, you can then change the compileSDK to a lower version and it should work. 设置完成后,您可以将compileSDK更改为较低版本,它应该可以正常工作。

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
}

I fixed this problem. 我解决了这个问题。 I just modified the compileSdk Version from android_L to 19 to target my nexus 4.4.4. 我刚刚将android_S中的compileSdk版本修改为19以定位我的nexus 4.4.4。

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'
    }
}
apply plugin: 'com.android.application'

repositories {
    jcenter()
}

android {
    **compileSdkVersion 'android-L'** modified to 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.antwei.uiframework.ui"
        minSdkVersion 14
        targetSdkVersion 'L'
        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:21.+'** modified to compile 'com.android.support:support-v4:20.0.0'
}

how to modified the value by ide. 如何通过ide修改值。

select file->Project Structure -> Facets -> android-gradle and then modified the compile Sdk Version from android_L to 19 选择文件 - >项目结构 - >构面 - > android-gradle然后将编译的Sdk版本从android_L修改为19

sorry I don't have enough reputation to add pictures 对不起,我没有足够的声誉来添加图片

I initially went into the SDK Manager and updated all that it had set to update. 我最初进入SDK Manager并更新了它设置为更新的所有内容。

I also added in the SDK version for the version of Android I had on the Droid I had...Version 2.3.4(10) 我还在SDK版本中添加了我在Droid上安装的Android版本......版本2.3.4(10)

I don't think that really fixed anything, and after a Android Studio restart as recommended after the SDK installs, I changed the minSdkVersion to 8 in the build.gradle file 我认为没有真正解决任何问题,并且在安装SDK之后按照建议重新启动Android Studio后,我在build.gradle文件中将minSdkVersion更改为8

I was then able to download the application to my Droid. 然后我就可以将应用程序下载到我的Droid了。

defaultConfig {
    applicationId "com.cmcjr.chuck.droid_u"
    minSdkVersion 8
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"
}

This is Android Studio installed on Ubuntu 12.04 这是安装在Ubuntu 12.04上的Android Studio

Just go to build.gradle(Module:App) and change the minSdkVersion to whatever you are using with emulator. 只需转到build.gradle(Module:App)并将minSdkVersion更改为您使用模拟器的任何内容。

Example: 例:

defaultConfig {
        applicationId "com.example.raghu.sample"
        // Change the version in following line
        minSdkVersion 10 // <-- Whatever you are using with Emulator
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

Just installed Android Studio v 0.8.1 beta and ran into the same problem targeting SDK 19. 刚刚安装了Android Studio v 0.8.1 beta并遇到了针对SDK 19的同样问题。

Copied 19 from the adt-bundle to android-studio, changed build.gradle to: 从adt-bundle复制到android-studio,将build.gradle更改为:

compileSdkVersion 19 targetSdkVersion 19 compileSdkVersion 19 targetSdkVersion 19

then project -> app -> open module settings (aka project structure): change compile sdk version to 19. 然后项目 - > app - >打开模块设置(又名项目结构):将编译sdk版本更改为19。

Now works fine. 现在工作正常。

类似于之前的一些帖子 - 我去了SDK管理器并卸载了v20和版本L.然后我安装了版本19,这个问题得到解决,我可以使用我的Android设备调试,没有错误。

Another way to support Android L is to use custom lpreview property for Gradle. 支持Android L的另一种方法是为Gradle使用自定义lpreview属性。 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. 通过这种方式,您可以使用lpreview于Android L的lpreview属性构建应用程序,而不使用以前版本的应用程序。

Try changing you sdk min version 尝试改变你的sdk min版本

<uses-sdk
    android:minSdkVersion="4"
    android:targetSdkVersion="19" />

Check the 'minSdkVersion' in your build.gradle 检查build.gradle中的'minSdkVersion'

The default project creates it with the latest API, so if you're phone is not yet up-dated (eg minSdkVersion 21 ), which is probably your case. 默认项目使用最新的API创建它,所以如果你的电话还没有更新(例如minSdkVersion 21 ),这可能就是你的情况。

Make sure the minSdkVersion value matches with the device API version or if the device has a higher one. 确保minSdkVersion值与设备API版本匹配,或者设备是否具有更高版本。

Example: 例:

defaultConfig {
    applicationId 'xxxxxx'
    minSdkVersion 16
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}

您的设备早于minSDK ,请在build.gradle中编辑minSdkVersion

One more place where minSdkVersion makes a sense is a flavor: minSdkVersion更有意义的另一个地方是味道:

productFlavors {
    dev {
        minSdkVersion 22
    }
    prod {
        minSdkVersion 9
    }
}

minSdkVersion (22) will not install on development devices with API level older than 22. minSdkVersion(22)不会安装在API级别低于22的开发设备上。

you need update. 你需要更新。

This is my current solution (09/2015). 这是我目前的解决方案(09/2015)。

In Android Studio search. 在Android Studio搜索中。

Menu --> Help --> check for update

Upate and problem solved!! Upate和问题解决了!!

Good luck 祝好运

Check the minimum API level inside the build.gradle(module: app)[inside of the gradle scripts]. 检查build.gradle(module:app)内部的最低API级别[gradle脚本内部]。 Thatt should be equal to or lower than the device you use 它应该等于或低于您使用的设备

在build.gradle中更改minSdkVersion 17或更高版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM