安装错误:INSTALL_FAILED_OLDER_SDK

时间:2021-04-10 17:02:51

I am new to Android development and I want first to get the Hello World application running. I am using Eclipse IDE and the Android 4.0.3 version 15 SDK. I copied everything from a tutorial site, but when I try to run the application on the virtual device I get this error:

我是Android开发的新手,我想首先让Hello World应用程序运行。我正在使用Eclipse IDE和Android 4.0.3版本15 SDK。我从教程站点复制了所有内容,但是当我尝试在虚拟设备上运行应用程序时,我收到此错误:

[2012-02-01 11:31:23 - Android_test] Installation error: INSTALL_FAILED_OLDER_SDK
[2012-02-01 11:31:23 - Android_test] Please check logcat output for more details.
[2012-02-01 11:31:23 - Android_test] Launch canceled!

Here is my class in the com.maze.app package: package com.maze.app;

这是我在com.maze.app包中的类:package com.maze.app;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity{
  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        tv.setText("Hello, Android");
        setContentView(tv);

    }

}

and the AndroidManifest.xml:

和AndroidManifest.xml:

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

<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="@string/app_name"/>

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity android:name="HelloAndroid" android:launchMode="standard" android:enabled="true"></activity>
</application>

Here is the configuration of the Virtual Device:

以下是虚拟设备的配置:

Name: AndroidVD
CPU/ABI: ARM(armeabi-v7a)
Path: path\to\avd
Target: Android 4.0.3(API level 15)
Skin: WVGA800
hw.lcd.density: 240
hw.cpu.model: cortex-a8
vm.heapSize: 48
hw.ramSize:512

What is the problem?

问题是什么?

EDIT: The application is not running on the Virtual Device: Here is what I get on LogCat(some of the lines):

编辑:应用程序没有在虚拟设备上运行:这是我在LogCat上获得的(一些行):

D/PackageManager(92): New package installed in /data/app/com.maze.app-2.apk
D/dalvikvm(92): GC_CONCURRENT freed 660K, 9% free 11935K/12999K, paused 18ms+72ms
I/ActivityManager(92): Force stopping package com.maze.app uid=10040
D/BackupManagerService(92): Received broadcast Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.maze.app flg=0x10000010 (has extras) }
V/BackupManagerService(92): updatePackageParticipantsLocked: com.maze.app

17 个解决方案

#1


101  

It is due to android:targetSdkVersion="@string/app_name" in your manifiest file.
Change it to:

这是由于你的最明显的文件中的android:targetSdkVersion =“@ string / app_name”。将其更改为:

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

The targetSdkVersion should be an integer, but @string/app_name would be a string. I think this causing the error.

targetSdkVersion应该是一个整数,但@ string / app_name将是一个字符串。我认为这会导致错误。

EDIT:
You have to add a default intent-filter in your manifiest file for the activity. Then only android can launch the activity. otherwise you will get the below error in your console window.

编辑:您必须在最活跃的文件中添加默认的intent-filter。然后只有android才能启动活动。否则您将在控制台窗口中收到以下错误。

[2012-02-02 09:17:39 - Test] No Launcher activity found!
[2012-02-02 09:17:39 - Test] The launch will only sync the application package on the device!

Add the following to your <activity> tag.

将以下内容添加到 标记中。

<activity android:name="HelloAndroid" android:launchMode="standard" android:enabled="true">  
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>

#2


21  

This means the version of android of your avd is older than the version being used to compile the code

这意味着你的avd的android版本比用于编译代码的版本旧

#3


14  

This error occurs when the sdk-version installed on your device (real or virtual device) is smaller than android:minSdkVersion in your android manifest.

当您的设备(真实或虚拟设备)上安装的sdk-version小于android清单中的android:minSdkVersion时,会发生此错误。

You either have to decrease your android:minSdkVersion or you have to specify a higher api-version for your AVD.

您要么必须减少android:minSdkVersion,要么必须为AVD指定更高的api版本。

Keep in mind, that it is not always trivial to decrease android:minSdkVersion as you have to make sure, your app cares about the actual installed API and uses the correct methods:

请记住,减少android:minSdkVersion并不总是微不足道,因为你必须确保,你的应用关心实际安装的API并使用正确的方法:

AsyncTask<String, Object, String> task = new AsyncTask<String, Object, String>() {
    @Override
    protected Boolean doInBackground(String... params) {
        if (params == null) return "";
        StringBuilder b = new StringBuilder();
        for (String p : params) {
             b.append(p);
        }
        return b.toString();
    }
};
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,"Hello", " ", "world!");
} else {
    task.execute("Hello", " ", "world!");
}

Using the android-support-library and/or libraries like actionbar-sherlock will help you dealing especially with widgets of older versions.

使用android-support-library和/或诸如actionbar-sherlock之类的库将帮助您处理旧版本的小部件。

#4


13  

I am using Android Studio 0.8.1. I have a project's gradle file like below:

我使用的是Android Studio 0.8.1。我有一个项目的gradle文件,如下所示:

android {
    compileSdkVersion 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.omersonmez.widgets.hotspot"
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

My emulator was android 4.0. So i modified my emulator and made api level 4.0.3(apilevel 15). It worked.

我的模拟器是android 4.0。所以我修改了我的模拟器并使api级别为4.0.3(apilevel 15)。有效。

#5


3  

I tried all the responses described here but my solution was changing inside my build.gradle file minSdkVersion from 8 to 9 because some libraries in my project can´t work with API 8, that´s was the reason for the message INSTALL_FAILED_OLDER_SDK:

我尝试了这里描述的所有响应,但我的解决方案是将build.gradle文件minSdkVersion从8改为9,因为我的项目中的某些库无法使用API​​ 8,这就是消息INSTALL_FAILED_OLDER_SDK的原因:

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 22
        buildToolsVersion "22.0.1"

        defaultConfig {
            applicationId "com.tuna.hello.androidstudioapplication"
            minSdkVersion 9
            targetSdkVersion 22
            versionCode 1
            versionName "1.0"
        }
...
...
...

#6


1  

In my case I edited a project having this in the AndroidManifest.xml file, and which was ginving me the above error, at runtime:

在我的例子中,我在AndroidManifest.xml文件中编辑了一个具有此项目的项目,并且在运行时将上面的错误给了我:

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

What I did just, was to change minSdkVersion="17", to minSdkVersion="16". My resulting tag was:

我做的只是将minSdkVersion =“17”更改为minSdkVersion =“16”。我得到的标签是:

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

Now I'm not getting the error anymore..

现在我不再收到错误..

Hope this helps

希望这可以帮助

#7


1  

Received the same error , the problem was difference in the version of Android SDK which AVD was using and the version in AndroidManifest file. I could solve it by correcting the

收到相同的错误,问题是AVD使用的Android SDK版本和AndroidManifest文件中的版本有所不同。我可以通过纠正它来解决它

android:minSdkVersion="16"

机器人:的minSdkVersion = “16”

to match with AVD.

与AVD相匹配。

#8


1  

Fix for new Android 6.0 Marshmallow Fixed my issue when I updated to API 23 (Android 6.0 Marshmallow) by updating the build tools version to 23.0.0 as follows:

修复新的Android 6.0 Marshmallow通过将构建工具版本更新到23.0.0更新到API 23(Android 6.0 Marshmallow)修复了我的问题,如下所示:

android {
    buildToolsVersion '23.0.0'
...

And went to File > Project Structure , chose Properties tab then updated the Compile Sdk version to "API 23: Android 5.X (MNC)" and the Build tools version to "23.0.0"

然后转到File> Project Structure,选择Properties选项卡,然后将Compile Sdk版本更新为“API 23:Android 5.X(MNC)”,并将Build tools版本更新为“23.0.0”

#9


0  

I am on Android Studio. I got this error when min/targetSDKVersion were set to 17. While looking thro this thread, I tried to change the minSDKVersion, voila..problem fixed. Go figure.. :(

我在Android Studio上。当min / targetSDKVersion设置为17时,我收到此错误。在查看此线程时,我尝试更改minSDKVersion,瞧瞧..问题已修复。去搞清楚.. :(

    android:minSdkVersion="17"
    android:targetSdkVersion="17" />

#10


0  

Make sure to check your build.gradle and that it doesn't use a newer SDK version than what is installed on your AVD. That's only if you use Android Studio though.

确保检查build.gradle,并且它不使用比AVD上安装的版本更新的SDK版本。这只是在您使用Android Studio时。

#11


0  

If you are totally new like me, you must install the minimum SDK at first. Check the link.

如果您像我一样全新,则必须首先安装最低SDK。检查链接。

This worked out perfectly for me:

这对我很有用:

Same problem other post with a good solution

同样问题其他帖子有一个很好的解决方案

Regards,

问候,

Khaled.

哈立德。

#12


0  

You will see the same error if you are trying to install an apk that was built using

如果您尝试安装使用构建的apk,您将看到相同的错误

compileSdkVersion "android-L"

Even for devices running the final version of Android 5.0. Simply change this to

即使是运行Android 5.0最终版本的设备。只需将其更改为

compileSdkVersion 21

#13


0  

My solution was to change the run configurations module drop-down list from wearable to android. (This error happened to me when I tried running Google's I/O Sched open-source app.) It would automatically pop up the configurations every time I tried to run until I changed the module to android.

我的解决方案是将运行配置模块下拉列表从可穿戴设备更改为安卓。 (当我尝试运行Google的I / O Sched开源应用程序时,这个错误发生在我身上。)每次我尝试运行时都会自动弹出配置,直到我将模块更改为android。

You can access the configurations by going to Run -> Edit Configurations... -> General tab -> Module: [drop-down-list-here]

您可以通过转到运行 - >编辑配置... - >常规选项卡 - >模块来访问配置:[drop-down-list-here]

#14


0  

I found that making the recommended change in the manifest didn't solve my problem.

我发现在清单中进行推荐的更改并没有解决我的问题。

The fix was found in the GradleScripts folder, in the build.gradle file for the Module:app.

修复程序位于GradleScripts文件夹中,位于Module:app的build.gradle文件中。

Inside this file (build.gradle) the following line was modified. minSdkVersion 22 I changed this '22' value to '19' for my particular phone and the build completed without error.

在此文件(build.gradle)中,修改了以下行。 minSdkVersion 22我将我的特定手机的'22'值更改为'19',并且构建完成且没有错误。

#15


0  

Mate, my advice is to change virtual device. Download "Genimotion" application, its easy to use and there are a lot of any devices you need

伙伴,我的建议是改变虚拟设备。下载“Genimotion”应用程序,它易于使用,并且您需要许多设备

#16


0  

Ionic Android emulator error INSTALL_FAILED_OLDER_SDK

Ionic Android模拟器错误INSTALL_FAILED_OLDER_SDK

So, basically it means that the installation has failed due to having an older SDK version than the targetSdkVersion specified in your app (it's a Gradle issue). Just edit the AndroidManifest.xml file and add the following code:

因此,基本上它意味着安装失败,因为SDK版本比应用程序中指定的targetSdkVersion更旧(这是Gradle问题)。只需编辑AndroidManifest.xml文件并添加以下代码:

<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="14"/>

After days looking for the solution, that's it.

经过几天的寻找解决方案,就是这样。

Works fine for me!

对我来说很好用!

#17


-2  

I've changed my android:minSdkVersion and android:targetSdkVersion to 18 from 21:

我已将我的android:minSdkVersion和android:targetSdkVersion从21改为18:

uses-sdk android:minSdkVersion="18" android:targetSdkVersion="18" 

Now I can install my app successfully.

现在我可以成功安装我的应用程序。

#1


101  

It is due to android:targetSdkVersion="@string/app_name" in your manifiest file.
Change it to:

这是由于你的最明显的文件中的android:targetSdkVersion =“@ string / app_name”。将其更改为:

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

The targetSdkVersion should be an integer, but @string/app_name would be a string. I think this causing the error.

targetSdkVersion应该是一个整数,但@ string / app_name将是一个字符串。我认为这会导致错误。

EDIT:
You have to add a default intent-filter in your manifiest file for the activity. Then only android can launch the activity. otherwise you will get the below error in your console window.

编辑:您必须在最活跃的文件中添加默认的intent-filter。然后只有android才能启动活动。否则您将在控制台窗口中收到以下错误。

[2012-02-02 09:17:39 - Test] No Launcher activity found!
[2012-02-02 09:17:39 - Test] The launch will only sync the application package on the device!

Add the following to your <activity> tag.

将以下内容添加到 标记中。

<activity android:name="HelloAndroid" android:launchMode="standard" android:enabled="true">  
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>

#2


21  

This means the version of android of your avd is older than the version being used to compile the code

这意味着你的avd的android版本比用于编译代码的版本旧

#3


14  

This error occurs when the sdk-version installed on your device (real or virtual device) is smaller than android:minSdkVersion in your android manifest.

当您的设备(真实或虚拟设备)上安装的sdk-version小于android清单中的android:minSdkVersion时,会发生此错误。

You either have to decrease your android:minSdkVersion or you have to specify a higher api-version for your AVD.

您要么必须减少android:minSdkVersion,要么必须为AVD指定更高的api版本。

Keep in mind, that it is not always trivial to decrease android:minSdkVersion as you have to make sure, your app cares about the actual installed API and uses the correct methods:

请记住,减少android:minSdkVersion并不总是微不足道,因为你必须确保,你的应用关心实际安装的API并使用正确的方法:

AsyncTask<String, Object, String> task = new AsyncTask<String, Object, String>() {
    @Override
    protected Boolean doInBackground(String... params) {
        if (params == null) return "";
        StringBuilder b = new StringBuilder();
        for (String p : params) {
             b.append(p);
        }
        return b.toString();
    }
};
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,"Hello", " ", "world!");
} else {
    task.execute("Hello", " ", "world!");
}

Using the android-support-library and/or libraries like actionbar-sherlock will help you dealing especially with widgets of older versions.

使用android-support-library和/或诸如actionbar-sherlock之类的库将帮助您处理旧版本的小部件。

#4


13  

I am using Android Studio 0.8.1. I have a project's gradle file like below:

我使用的是Android Studio 0.8.1。我有一个项目的gradle文件,如下所示:

android {
    compileSdkVersion 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.omersonmez.widgets.hotspot"
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

My emulator was android 4.0. So i modified my emulator and made api level 4.0.3(apilevel 15). It worked.

我的模拟器是android 4.0。所以我修改了我的模拟器并使api级别为4.0.3(apilevel 15)。有效。

#5


3  

I tried all the responses described here but my solution was changing inside my build.gradle file minSdkVersion from 8 to 9 because some libraries in my project can´t work with API 8, that´s was the reason for the message INSTALL_FAILED_OLDER_SDK:

我尝试了这里描述的所有响应,但我的解决方案是将build.gradle文件minSdkVersion从8改为9,因为我的项目中的某些库无法使用API​​ 8,这就是消息INSTALL_FAILED_OLDER_SDK的原因:

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 22
        buildToolsVersion "22.0.1"

        defaultConfig {
            applicationId "com.tuna.hello.androidstudioapplication"
            minSdkVersion 9
            targetSdkVersion 22
            versionCode 1
            versionName "1.0"
        }
...
...
...

#6


1  

In my case I edited a project having this in the AndroidManifest.xml file, and which was ginving me the above error, at runtime:

在我的例子中,我在AndroidManifest.xml文件中编辑了一个具有此项目的项目,并且在运行时将上面的错误给了我:

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

What I did just, was to change minSdkVersion="17", to minSdkVersion="16". My resulting tag was:

我做的只是将minSdkVersion =“17”更改为minSdkVersion =“16”。我得到的标签是:

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

Now I'm not getting the error anymore..

现在我不再收到错误..

Hope this helps

希望这可以帮助

#7


1  

Received the same error , the problem was difference in the version of Android SDK which AVD was using and the version in AndroidManifest file. I could solve it by correcting the

收到相同的错误,问题是AVD使用的Android SDK版本和AndroidManifest文件中的版本有所不同。我可以通过纠正它来解决它

android:minSdkVersion="16"

机器人:的minSdkVersion = “16”

to match with AVD.

与AVD相匹配。

#8


1  

Fix for new Android 6.0 Marshmallow Fixed my issue when I updated to API 23 (Android 6.0 Marshmallow) by updating the build tools version to 23.0.0 as follows:

修复新的Android 6.0 Marshmallow通过将构建工具版本更新到23.0.0更新到API 23(Android 6.0 Marshmallow)修复了我的问题,如下所示:

android {
    buildToolsVersion '23.0.0'
...

And went to File > Project Structure , chose Properties tab then updated the Compile Sdk version to "API 23: Android 5.X (MNC)" and the Build tools version to "23.0.0"

然后转到File> Project Structure,选择Properties选项卡,然后将Compile Sdk版本更新为“API 23:Android 5.X(MNC)”,并将Build tools版本更新为“23.0.0”

#9


0  

I am on Android Studio. I got this error when min/targetSDKVersion were set to 17. While looking thro this thread, I tried to change the minSDKVersion, voila..problem fixed. Go figure.. :(

我在Android Studio上。当min / targetSDKVersion设置为17时,我收到此错误。在查看此线程时,我尝试更改minSDKVersion,瞧瞧..问题已修复。去搞清楚.. :(

    android:minSdkVersion="17"
    android:targetSdkVersion="17" />

#10


0  

Make sure to check your build.gradle and that it doesn't use a newer SDK version than what is installed on your AVD. That's only if you use Android Studio though.

确保检查build.gradle,并且它不使用比AVD上安装的版本更新的SDK版本。这只是在您使用Android Studio时。

#11


0  

If you are totally new like me, you must install the minimum SDK at first. Check the link.

如果您像我一样全新,则必须首先安装最低SDK。检查链接。

This worked out perfectly for me:

这对我很有用:

Same problem other post with a good solution

同样问题其他帖子有一个很好的解决方案

Regards,

问候,

Khaled.

哈立德。

#12


0  

You will see the same error if you are trying to install an apk that was built using

如果您尝试安装使用构建的apk,您将看到相同的错误

compileSdkVersion "android-L"

Even for devices running the final version of Android 5.0. Simply change this to

即使是运行Android 5.0最终版本的设备。只需将其更改为

compileSdkVersion 21

#13


0  

My solution was to change the run configurations module drop-down list from wearable to android. (This error happened to me when I tried running Google's I/O Sched open-source app.) It would automatically pop up the configurations every time I tried to run until I changed the module to android.

我的解决方案是将运行配置模块下拉列表从可穿戴设备更改为安卓。 (当我尝试运行Google的I / O Sched开源应用程序时,这个错误发生在我身上。)每次我尝试运行时都会自动弹出配置,直到我将模块更改为android。

You can access the configurations by going to Run -> Edit Configurations... -> General tab -> Module: [drop-down-list-here]

您可以通过转到运行 - >编辑配置... - >常规选项卡 - >模块来访问配置:[drop-down-list-here]

#14


0  

I found that making the recommended change in the manifest didn't solve my problem.

我发现在清单中进行推荐的更改并没有解决我的问题。

The fix was found in the GradleScripts folder, in the build.gradle file for the Module:app.

修复程序位于GradleScripts文件夹中,位于Module:app的build.gradle文件中。

Inside this file (build.gradle) the following line was modified. minSdkVersion 22 I changed this '22' value to '19' for my particular phone and the build completed without error.

在此文件(build.gradle)中,修改了以下行。 minSdkVersion 22我将我的特定手机的'22'值更改为'19',并且构建完成且没有错误。

#15


0  

Mate, my advice is to change virtual device. Download "Genimotion" application, its easy to use and there are a lot of any devices you need

伙伴,我的建议是改变虚拟设备。下载“Genimotion”应用程序,它易于使用,并且您需要许多设备

#16


0  

Ionic Android emulator error INSTALL_FAILED_OLDER_SDK

Ionic Android模拟器错误INSTALL_FAILED_OLDER_SDK

So, basically it means that the installation has failed due to having an older SDK version than the targetSdkVersion specified in your app (it's a Gradle issue). Just edit the AndroidManifest.xml file and add the following code:

因此,基本上它意味着安装失败,因为SDK版本比应用程序中指定的targetSdkVersion更旧(这是Gradle问题)。只需编辑AndroidManifest.xml文件并添加以下代码:

<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="14"/>

After days looking for the solution, that's it.

经过几天的寻找解决方案,就是这样。

Works fine for me!

对我来说很好用!

#17


-2  

I've changed my android:minSdkVersion and android:targetSdkVersion to 18 from 21:

我已将我的android:minSdkVersion和android:targetSdkVersion从21改为18:

uses-sdk android:minSdkVersion="18" android:targetSdkVersion="18" 

Now I can install my app successfully.

现在我可以成功安装我的应用程序。