Auto generated build manifest file AndroidManifest.xml installs unwanted application on device

2k views Asked by At

I'm using Todd's ProgressWheel in my project and every time I install my app two icons appear on the device , one for my actual app and one for ProgressWheel. I believe the problem lays in the auto-generated manifest file from ProgressWheel ,which I cannot edit:

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

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

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar" >
        <activity
            android:name="com.todddavies.components.progressbar.main"
            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>

I know that "action MAIN" and "category LAUNCHER" are causing the issue, but how do I take care of this if I cannot edit the file as it gets overwritten every time I compile. The ProgressWheel is included in my project through dependency

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.github.Todd-Davies:ProgressWheel:[1.0]'
}
1

There are 1 answers

1
CommonsWare On BEST ANSWER

Auto generated build manifest file AndroidManifest.xml installs unwanted application on device

No, it does not.

I'm using Todd's ProgressWheel in my project and every time I install my app two icons appear on the device , one for my actual app and one for ProgressWheel.

More accurately, two icons appear in your home screen's launcher. These represent two activities, but only one app.

but how do I take care of this if I cannot edit the file as it gets overwritten every time I compile

The best answer is to use a better progress wheel library, as we have a few dozen of them, and the one you chose is poorly packaged.

If you really want to use the library, in your own manifest, as a child of the <application> element, add:

<activity
        android:name="com.todddavies.components.progressbar.main"
        tools:node="remove" />

This will require you to add the xmlns:tools="http://schemas.android.com/tools" namespace declaration to your <manifest> element.

What this <activity> element does is say "hey, build system, we are pulling in a com.todddavies.components.progressbar.main activity from a library, but get rid of it". This will be handled as part of the manifest merger process.