失败[INSTALL_FAILED_OLDER_SDK] Android Studio

Pan*_*96c 5 xml sdk android

我是Android新手,我正在使用Android Studio.我创建了一个新项目来展示Hello World!但由于这个错误,我无法让它在AVD上工作:失败[INSTALL_FAILED_OLDER_SDK].

我已经搜索了答案,我知道它是关于build.gradle和minSdkVersion的,但任何答案都适合我.

这是我的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>
Run Code Online (Sandbox Code Playgroud)

这是我的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'])
}
Run Code Online (Sandbox Code Playgroud)

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

谢谢!

Tan*_*.7x 6

除非您知道要在应用程序中使用Android L开发人员预览,否则不要使用它进行定位和编译.它仍然是一个预览版本,看起来应用程序定位和编译预览会导致任何非L设备出现此错误.

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

android {
    compileSdkVersion 19

    defaultConfig {
        targetSdkVersion 19
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 这样可行,但是如果``res/values-v21`中的`styles.xml`文件引用了`android:Theme.Material.Light.DarkActionBar`,则会触发`错误检索项的父项:否找到的匹配给定名称的资源'android:Theme.Material.Light.DarkActionBar' (3认同)