安装错误:INSTALL_FAILED_OLDER_SDK [英] Installation error: INSTALL_FAILED_OLDER_SDK
问题描述
我是新的Android开发,我想首先要获得的Hello World
应用程序运行时。
我使用的Eclipse IDE和Android 4.0.3版本SDK 15。我复制一切从一个教程网站,但是当我尝试运行虚拟设备上的应用程序
我得到这个错误:
[2012-02-01 11时31分23秒 - Android_test]安装错误:INSTALL_FAILED_OLDER_SDK
[2012-02-01十一点31分23秒 - Android_test]请logcat的输出获取更多信息。
[2012-02-01十一点31分23秒 - Android_test]启动取消!
下面是我在 com.maze.app </ code>包类:
包com.maze.app;
进口android.app.Activity;
进口android.os.Bundle;
进口android.widget.TextView;
公共类HelloAndroid延伸活动{
@覆盖
公共无效的onCreate(包savedInstanceState){
super.onCreate(savedInstanceState);
TextView的电视=新的TextView(本);
tv.setText(你好,Android的);
的setContentView(电视);
}
}
和的AndroidManifest.xml
:
&LT; XML版本=1.0编码=UTF-8&GT?;
&LT;舱单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=com.maze.app
安卓版code =1
机器人:VERSIONNAME =1.0&GT;
&LT;使用-SDK安卓的minSdkVersion =15机器人:targetSdkVersion =@字符串/ APP_NAME/&GT;
&lt;应用
机器人:图标=@可绘制/ ic_launcher
机器人:标签=@字符串/ APP_NAME&GT;
&LT;活动机器人:名称=HelloAndroid机器人:launchMode =标准的Android:启用=真正的&GT;&LT; /活性GT;
&LT; /用途&gt;
下面是虚拟设备
的配置:
名称:AndroidVD
CPU / ABI:ARM(armeabi-V7A)
路径:路径\到\ AVD
目标:安卓4.0.3(API等级15)
皮肤:WVGA800
hw.lcd.density:240
hw.cpu.model:Cortex-A8的
vm.heapSize:48
hw.ramSize:512
这是什么问题?
编辑: 该应用程序不能在虚拟设备上运行: 以下是我得到LogCat中(某些行):
D / PackageManager(92):新的程序包安装在/data/app/com.maze.app-2.apk
D / dalvikvm(92):GC_CONCURRENT释放660K,9%的自由11935K / 12999K,暂停18毫秒+ 72ms的
I / ActivityManager(92):强制停止包com.maze.app的uid = 10040
D / BackupManagerService(92):接收到的广播意向{行为= android.intent.action.PACKAGE_REPLACED DAT =包:com.maze.app FLG = 0x10000010(有群众演员)}
V / BackupManagerService(92):updatePackageParticipantsLocked:com.maze.app
这是由于机器人:targetSdkVersion =@字符串/ APP_NAME
在manifiest文件< BR>
将其更改为:
&LT;使用-SDK安卓的minSdkVersion =15机器人:targetSdkVersion =15/&GT;
在 targetSdkVersion
应该是一个整数,但 @字符串/ APP_NAME
将是一个字符串。我想,这导致错误。
编辑:
你必须添加默认意图过滤器
在 manifiest
文件的活动。那么只有机器人可以启动该活动。否则你将得到下面的错误在你的控制台窗口。
[2012-02-02 9时17分39秒 - 测试]没有启动的活动找到了!
[2012-02-02 9点17分39秒 - 测试]的推出,将只同步应用程序包的设备上!
以下内容添加到您的&LT;活性GT;
标记。
&LT;活动机器人:名称=HelloAndroid机器人:launchMode =标准的Android:启用=真正的&GT;
&LT;意向滤光器&gt;
&lt;作用机器人:名称=android.intent.action.MAIN/&GT;
&LT;类机器人:名称=android.intent.category.LAUNCHER/&GT;
&所述; /意图滤光器&gt;
&LT; /活性GT;
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:
[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;
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
:
<?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):
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
It is due to android:targetSdkVersion="@string/app_name"
in your manifiest file.
Change it to:
<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.
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.
[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>
这篇关于安装错误:INSTALL_FAILED_OLDER_SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!