user336063
user336063

Reputation:

Uninstalling Android Application

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

  1. Run Eclipse
  2. Click File->New->Project...
  3. Select Android/Android Application Project
  4. Click Next.
  5. Enter Application Name: Test
  6. Build SDK: Android 4.1
  7. Minimum Required SDK: API 8 Android 2.2
  8. Enable: Create custom launcher icon / Create project in workspace
  9. Click Next thrice.
  10. Click Finish.
  11. Connect 4.1 Android device to computer via USB.
  12. Click Run->Run from menu.
  13. Select "Android application" on popup the "Run As" popup.
  14. Click Ok.
  15. MainActivity application runs on device.
  16. Click the Back button on the Android device.
  17. Open applications on device and find "MainActivity" app.
  18. 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?
  1. Why do I get this message instead of the standard one?
  2. 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>

Upvotes: 4

Views: 3441

Answers (3)

Sanjeev Chavan
Sanjeev Chavan

Reputation: 441

Make sure your app name app_name is not styled.

Since I was using the app name somewhere else in the app I had made it bold, like this - In my strings.xml

<string name="app_name"><b>We are sons<b></string>

When I removed

<b></b>

tags, it worked.

Just keep it :

<string name="app_name">We are sons</string>

Upvotes: 2

user336063
user336063

Reputation:

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>

Upvotes: 18

Yury
Yury

Reputation: 20936

I do not know how to solve the first issue but the second can be solved in the following way. The problem is connected with Android new project wizzard. To solve this problem you can correct your manifest file in the following way and redeploy your project:

<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 android:label="@string/app_name" >
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

Do not forget to check what is the value of app_name. Some more details you can find in this post

Upvotes: 1

Related Questions