简体   繁体   English

失败[INSTALL_FAILED_OLDER_SDK] Android Studio

[英]Failure [INSTALL_FAILED_OLDER_SDK] Android Studio

I'm new to Android and I'm using the Android Studio. 我是Android新手,正在使用Android Studio。 I've created a new project just to show the Hello World! 我创建了一个新项目只是为了展示Hello World! but I can't get it working on the AVD because of this error: Failure [INSTALL_FAILED_OLDER_SDK]. 但由于以下错误,我无法在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! 谢谢!

Unless you know you want to be using the Android L developer preview with your application, do not target and compile with it. 除非您知道要在应用程序中使用Android L开发人员预览版,否则请不要针对它进行编译。 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. 它仍然仍然是一个预览版本,似乎针对非预览设备定位和编译该预览的应用程序会导致此错误。

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
    }
}

I think projects with 我认为与

 compileSdkVersion 'android-L'

cannot be installed in other Android versions right now. 目前无法在其他Android版本中安装。 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. 我在这里可能是错的,但是如果您不执行L预览SDK的特定操作,只需将编译版本设置为正式版本之一即可。 Same goes for the targetSdk. targetSdk也是如此。

You can choose those in the Create Project wizard. 您可以在“创建项目”向导中选择那些。

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. 如何通过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 抱歉,我没有足够的声誉来添加图片

如果在编译Adobe AIR移动应用程序时收到此错误-只需更正“ minSdkVersion”,即可在应用程序描述符xml文件中的以下行:

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

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

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