失败 [INSTALL_FAILED_OLDER_SDK] Android Studio

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24518418/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:20:05  来源:igfitidea点击:

Failure [INSTALL_FAILED_OLDER_SDK] Android Studio

androidxmlsdk

提问by Pantera96c

I'm new to Android and I'm using the Android Studio. I've created a new project just to show the Hello World! but I can't get it working on the AVD because of this error: Failure [INSTALL_FAILED_OLDER_SDK].

我是 Android 新手,我正在使用 Android Studio。我创建了一个新项目只是为了展示 Hello World!但由于此错误,我无法在 AVD 上运行它:失败 [INSTALL_FAILED_OLDER_SDK]。

I already searched for the answer and I know it's something about the build.gradle and the minSdkVersion but any of the answers worked for me.

我已经搜索了答案,我知道它与 build.gradle 和 minSdkVersion 有关,但任何答案都对我有用。

This is my AndroidManifest.xml :

这是我的 AndroidManifest.xml :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.scoelli.test" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MyActivity"
            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>

And this is my build.gradle :

这是我的 build.gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'android-L'
    buildToolsVersion "20.0.0"

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

I would appreciate not only the answer but the explanation.

我不仅会感谢答案,还会感谢解释。

Thank You!

谢谢你!

回答by Bryan Herbst

Unless you know you want to be using the Android L developer preview with your application, do not target and compile with it. It is still very much a preview release, and it appears as though applications targeting and compiling for the preview cause this error with any non-L device.

除非您知道要在您的应用程序中使用 Android L 开发人员预览版,否则不要以它为目标并使用它进行编译。它仍然是一个预览版,看起来好像针对预览版的应用程序和编译会导致任何非 L 设备出现此错误。

Update these lines in your build.gradle to stick with the latest stable release (Android 4.4, API 19):

更新 build.gradle 中的这些行以坚持使用最新的稳定版本(Android 4.4,API 19):

android {
    compileSdkVersion 19

    defaultConfig {
        targetSdkVersion 19
    }
}

回答by fweigl

I think projects with

我认为项目与

 compileSdkVersion 'android-L'

cannot be installed in other Android versions right now. I might be wrong there but if you're not doing anything specific to the L preview SDK, just set the compile version to one of the official ones. Same goes for the targetSdk.

目前无法安装在其他 Android 版本中。我可能错了,但如果你没有做任何特定于 L 预览版 SDK 的事情,只需将编译版本设置为官方版本之一。targetSdk 也是如此。

You can choose those in the Create Project wizard.

您可以在“创建项目”向导中选择这些。

回答by u3392200

I fixed this problem. I just modified the compileSdkVersion from android_L to 19 to target my nexus 4.4.4.

我解决了这个问题。我刚刚将 compileSdkVersion 从 android_L 修改为 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. select file->Project Structure -> Facets -> android-gradle and then modified the compile Sdk Version from android_L to 19

如何通过ide修改值。选择file->Project Structure -> Facets -> android-gradle 然后将compile Sdk Version从android_L修改为19

sorry I don't have enough reputation to add pictures

抱歉,我没有足够的声誉来添加图片

回答by Deyan Vitanov

If you get this error when compiling Adobe AIR mobile app - just correct "minSdkVersion" this line in the application descriptor xml file:

如果您在编译 Adob​​e AIR 移动应用程序时遇到此错误 - 只需更正应用程序描述符 xml 文件中的“minSdkVersion”这一行:

<uses-sdk android:minSdkVersion="13" android:targetSdkVersion="15"></uses-sdk>