自动生成的构建清单文件 AndroidManifest.xml 在设备上安装不需要的应用程序

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

我在我的项目中使用 Todd 的 ProgressWheel,每次我安装我的应用程序时,设备上都会出现两个图标,一个用于我的实际应用程序,一个用于 ProgressWheel。我认为问题在于 ProgressWheel 自动生成的清单文件,我无法编辑它:

    <?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>

我知道 "action MAIN" 和 "category LAUNCHER" 导致了这个问题,但是如果我无法编辑文件,我该如何处理这个问题,因为它在每次编译时都会被覆盖。 ProgressWheel 通过 dependency

包含在我的项目中
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.github.Todd-Davies:ProgressWheel:[1.0]'
}

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

不,不是。

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.

更准确地说,主屏幕的启动器中会出现两个图标。这些代表两个活动,但只有一个应用程序。

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

最好的办法是使用更好的进度轮库,我们有a few dozen of them,而您选择的那个包装不好。

如果您真的想要使用库,在您自己的清单中,作为 <application> 元素的子元素,添加:

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

这将要求您将 xmlns:tools="http://schemas.android.com/tools" 命名空间声明添加到 <manifest> 元素。

这个 <activity> 元素的作用是说 "hey, build system, we are pulling in a com.todddavies.components.progressbar.main activity from a library, but get rid of it"。这将作为 the manifest merger process.

的一部分处理