卸载Android应用程序 [英] Uninstalling Android Application
问题描述
当我在Eclipse中创建一个Android项目并将其发送到我的设备进行调试,应用工作正常,但是当我尝试卸载它,我得到一个奇怪的消息。下面是我的重现问题的步骤:
Eclipse版本:4.2.0版本ID:I20120608-1400
ADT版本:2.0.3 v201208082019-427395
- 运行Eclipse中
- 单击文件 - >新建 - >项目...
- 选择的Android / Android的应用程序项目
- 点击下一步。
- 输入应用名称:测试
- 构建SDK:Android的4.1
- 最低要求SDK:API 8的Android 2.2
- 启用:创建自定义启动图标/工作区创建项目
- 单击下一步三次。
- 单击Finish(完成)。
- 通过USB 4.1的Android设备连接到计算机上。
- 点击运行 - >从菜单中选择运行。
- 在弹出的运行方式弹出选择Android应用程序。
- 单击确定。
- MainActivity应用程序在设备上运行。
- 点击Android设备上的后退按钮。
- 在设备中打开应用程序,找到MainActivity应用程序。
- 龙preSS在MainActivity图标并拖动到垃圾桶。
下面是令人费解的部分:
而不是得到一个标准的
你想卸载此应用?块引用>我得到这个文本的对话框:
MainActivity是以下应用程序的一部分:测试你要卸载此应用程序吗?
块引用>
- 为什么我得到这个消息,而不是标准之一?
- 为什么MainActivity当我明确表示该应用程序的名称是测试应用程序的名称?
附加信息:
如果我去设置 - >应用程序,应用程序显示为测试但在我启动的MainActivity列。AndroidManifest.xml中
<清单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=com.example.test
安卓版code =1
机器人:=的versionName1.0><用途-SDK
安卓的minSdkVersion =8
机器人:targetSdkVersion =15/><应用
机器人:图标=@绘制/ ic_launcher
机器人:标签=@字符串/ APP_NAME
机器人:主题=@风格/ AppTheme>
<活动
机器人:名字=。MainActivity
机器人:标签=@字符串/ title_activity_main>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.MAIN/> <类机器人:名字=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT;
< /用途>
解决方案解决方法是删除Android的:在活动元素标签=@字符串/ title_activity_main
下面的AndroidManifest.xml中解决了在Android 4.1.1的问题。
<清单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=com.example.test
安卓版code =1
机器人:=的versionName1.0><用途-SDK
安卓的minSdkVersion =8
机器人:targetSdkVersion =15/><应用
机器人:图标=@绘制/ ic_launcher
机器人:标签=@字符串/ APP_NAME
机器人:主题=@风格/ AppTheme> <活动
机器人:名字=MainActivity。>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.MAIN/> <类机器人:名字=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT;
< /用途>When I create an Android project in Eclipse and send it to my device for debugging, the app works fine but when I try to uninstall it, I get a strange message. Below are the steps to recreate my problem:
Eclipse Version: 4.2.0 Build id: I20120608-1400
ADT Version: 2.0.3 v201208082019-427395
- Run Eclipse
- Click File->New->Project...
- Select Android/Android Application Project
- Click Next.
- Enter Application Name: Test
- Build SDK: Android 4.1
- Minimum Required SDK: API 8 Android 2.2
- Enable: Create custom launcher icon / Create project in workspace
- Click Next thrice.
- Click Finish.
- Connect 4.1 Android device to computer via USB.
- Click Run->Run from menu.
- Select "Android application" on popup the "Run As" popup.
- Click Ok.
- MainActivity application runs on device.
- Click the Back button on the Android device.
- Open applications on device and find "MainActivity" app.
- Long press the MainActivity icon and drag to trash.
Here's the puzzling part:
Instead of getting a standard
Do you want to uninstall this app?I get a dialog with this text:
MainActivity is part of the following app: Test Do you want to uninstall this app?
- Why do I get this message instead of the standard one?
- Why is MainActivity the name of the app when I specifically stated the name of the app is "Test"?
Additional Information: If I go to Settings->Apps, the Application shows up as Test but is listed in my Launcher as MainActivity.
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.test" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application>
解决方案The solution is to remove android:label="@string/title_activity_main" in the activity element.
The AndroidManifest.xml below solves the problem on Android 4.1.1 .
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.test" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application>
这篇关于卸载Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!