【问题标题】:Failure [INSTALL_FAILED_OLDER_SDK] Android Studio失败 [INSTALL_FAILED_OLDER_SDK] Android Studio
【发布时间】:2014-07-01 20:04:14
【问题描述】:

我是 Android 新手,我正在使用 Android Studio。我创建了一个新项目只是为了展示 Hello World!但由于此错误,我无法让它在 AVD 上运行:Failure [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>

这是我的 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'])
}

我不仅希望得到答案,还希望得到解释。

谢谢!

【问题讨论】:

标签: android xml sdk


【解决方案1】:

除非您知道要在您的应用程序中使用 Android L 开发者预览版,否则不要使用它进行定位和编译。它仍然是一个预览版,似乎针对预览版的应用程序和编译会导致任何非 L 设备出现此错误。

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

android {
    compileSdkVersion 19

    defaultConfig {
        targetSdkVersion 19
    }
}

【讨论】:

  • 这行得通,但是如果您在 ../res/values-v21 中有一个引用 android:Theme.Material.Light.DarkActionBarstyles.xml 文件,它就会退出 Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.DarkActionBar'.
【解决方案2】:

我解决了这个问题。 我刚刚将 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'
}

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

对不起,我没有足够的声誉来添加图片

【讨论】:

    【解决方案3】:

    我认为项目与

     compileSdkVersion 'android-L'
    

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

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

    【讨论】:

      【解决方案4】:

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多