Android Studio 中的“失败 [INSTALL_FAILED_OLDER_SDK]”是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20622255/
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 03:09:25  来源:igfitidea点击:

What does "Failure [INSTALL_FAILED_OLDER_SDK]" mean in Android Studio?

androidandroid-studioandroid-2.2-froyo

提问by Abel Callejo

I got this Froyo(2.2) device that I am using to make an app. When I try to run the app directly to the device it shows an error saying

我得到了用于制作应用程序的Froyo(2.2) 设备。当我尝试将应用程序直接运行到设备时,它显示一条错误消息

pkg: /data/local/tmp/com.example.HelloWorldProject
Failure [INSTALL_FAILED_OLDER_SDK]

and in another window there's an error saying

并且在另一个窗口中有一个错误说

Unable to attach test reporter to test framework or test framework quit unexpectedly

What seem to make the said errors?

是什么导致了上述错误?

EDIT:

编辑:

AndroidManifest.xml

AndroidManifest.xml

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

    <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="17"/>

    <application
            android:allowBackup="true"
            android:debuggable="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            >
        <activity
                android:name="com.example.HelloWorldProject.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>

回答by chengbo

After I changed

我改变后

defaultConfig {
    applicationId "com.example.bocheng.myapplication"
    minSdkVersion 15
    targetSdkVersion 'L' #change this to 19
    versionCode 1
    versionName "1.0"
}

in build.gradlefile.

build.gradle文件中。

it works

有用

回答by hichris123

This error

这个错误

Failure [INSTALL_FAILED_OLDER_SDK]

Means that you're trying to install an app that has a higher minSdkVersionspecified in its manifest than the device's API level. Change that number to 8and it should work. I'm not sure about the other error, but it may be related to this one.

意味着您尝试安装的应用minSdkVersion在其清单中指定的级别高于设备的 API 级别。将该数字更改为8它应该可以工作。我不确定另一个错误,但它可能与这个错误有关。

回答by iBaff

Besides checking the right minSdkVersionin build.gradle, make sure you have installed all necessary toolsand correct SDK Platformfor your preferred Android Version in SDK Manager. In Android Studioklick on Tools-> Android-> SDK Manager. Then install at minimum (for Android 2.2 without emulator):

除了检查正确minSdkVersionbuild.gradle,请确保你已经安装了所有必要的tools,正确的SDK Platform为您首选的Android版本中SDK Manager。在Android Studio 中点击Tools-> Android-> SDK Manager。然后至少安装(对于没有模拟器的 Android 2.2):

  • Android SDK Tools
  • Android SDK Platform-tools
  • Android SDK Build-tools (latest)
  • Android 2.2 (API 8)
    • SDK Platform
    • Google APIs
  • Android SDK 工具
  • Android SDK 平台工具
  • Android SDK 构建工具(最新)
  • 安卓 2.2 (API 8)
    • SDK平台
    • 谷歌 API

This is what worked for me.

这对我有用。

回答by Scott Barta

Make sure you don't have a minSdkVersionset in your build.gradlewith a value higher than 8. If you don't specify it at all, it's supposed to use the value in your AndroidManfiest.xml, which seems to already be properly set.

确保您的minSdkVersion集合中没有build.gradle高于 8 的值。如果您根本没有指定它,则应该使用您的 中的值,该值AndroidManfiest.xml似乎已经正确设置。

回答by RavitejaMulukuri

Just removing uses-sdktag works for me for such problems.

只需删除uses-sdk标签即可解决此类问题。

回答by Al-Kathiri Khalid

Failure [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.

失败 [INSTALL_FAILED_OLDER_SDK]基本上意味着安装失败,因为目标位置(AVD/设备)的 SDK 版本比您的应用中指定的 targetSdkVersion 旧。

N/B Froyo 2.2 API 8

不适用 Froyo 2.2 API 8

To fix this simply change

要解决这个问题,只需更改

targetSdkVersion="17"to targetSdkVersion="8"

targetSdkVersion="17"targetSdkVersion="8"

cheers.

干杯。

回答by Nirav Bhavsar

Make Sure the Select Run/Debug Configuration is wear or mobile as per your installation in android studio...

根据您在 android studio 中的安装,确保 Select Run/Debug Configuration 是耐磨的或移动的...

回答by Azzi Youssef

Failure [INSTALL_FAILED_OLDER_SDK]

失败 [INSTALL_FAILED_OLDER_SDK]

For Sumsung note3I just edit the AndroidManifest.xmlfile and add the following code:

对于Sumsung note3,我只需编辑AndroidManifest.xml文件并添加以下代码:

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17"/>

回答by meda

Fix your gradle file the following way

通过以下方式修复您的 gradle 文件

defaultConfig {
    applicationId "package.com.app"
    minSdkVersion 8 //this should be lower than your device
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}

回答by gnganpath

In android studio: reduce minSDKversion. It will work...

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "healthcare.acceliant.trianz.com.myapplication"
        minSdkVersion 11
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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