android - 尝试解决在AndroidManifest.xml中检测到的重复软件包

标签 android eclipse maven compiler-errors pom.xml

我有一个android应用程序(以及随附的web/appengine应用程序),可以很好地与端点v1配合使用,并按现在的要求尝试使用端点v2进行构建/使用。我将每个项目都转换为Maven项目,但无法构建android应用。

这是我目前的错误:

[INFO]
[INFO] ------------------< TopCaddieMobile:TopCaddieMobile >-------------------
[INFO] Building TopCaddie 0.0.1-SNAPSHOT
[INFO] --------------------------------[ apk ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ TopCaddieMobile ---
[INFO] Deleting C:\Users\steve\eclipse-workspace\TopCaddieMobile\target
[INFO]
[INFO] --- android-maven-plugin:4.3.0:generate-sources (default-generate-sources) @ TopCaddieMobile ---
[INFO] Manifest copied from C:\Users\steve\eclipse-workspace\TopCaddieMobile\src\main\AndroidManifest.xml to C:\Users\steve\eclipse-workspace\TopCaddieMobile\target\AndroidManifest.xml
[INFO] Extracting libs
[INFO] Extracting aar support-compat...
[INFO] Extracting aar runtime...
[INFO] Extracting aar versionedparcelable...
[INFO] Extracting aar cursoradapter...
[INFO] Extracting aar support-core-utils...
[INFO] Extracting aar documentfile...
[INFO] Extracting aar loader...
[INFO] Extracting aar livedata...
[INFO] Extracting aar runtime...
[INFO] Extracting aar livedata-core...
[INFO] Extracting aar localbroadcastmanager...
[INFO] Extracting aar print...
[INFO] Extracting aar support-fragment...
[INFO] Extracting aar support-core-ui...
[INFO] Extracting aar customview...
[INFO] Extracting aar viewpager...
[INFO] Extracting aar coordinatorlayout...
[INFO] Extracting aar drawerlayout...
[INFO] Extracting aar slidingpanelayout...
[INFO] Extracting aar interpolator...
[INFO] Extracting aar swiperefreshlayout...
[INFO] Extracting aar asynclayoutinflater...
[INFO] Extracting aar viewmodel...
[INFO] Extracting aar support-vector-drawable...
[INFO] Extracting aar animated-vector-drawable...
[ERROR] Error when generating sources.
org.apache.maven.plugin.MojoExecutionException:
Duplicate packages detected in AndroidManifest.xml files

Such scenario generally means that the build will fail with a compilation error due to missing resources in R file.
You should consider renaming some of the duplicate packages listed below to avoid the conflict.

Conflicting artifacts:
    [animated-vector-drawable, support-vector-drawable] have similar package='android.support.graphics.drawable'


You can downgrade the failure to a warning by setting the 'failOnDuplicatePackages' plugin property to false.
    at com.simpligility.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.checkPackagesForDuplicates (GenerateSourcesMojo.java:746)
    at com.simpligility.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute (GenerateSourcesMojo.java:326)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  18.134 s
[INFO] Finished at: 2020-01-12T11:53:35-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.simpligility.maven.plugins:android-maven-plugin:4.3.0:generate-sources (default-generate-sources) on project TopCaddieMobile:

这是我的pom文件:
<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>TopCaddieMobile</groupId>
  <artifactId>TopCaddieMobile</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>TopCaddie</name>
  <packaging>apk</packaging>
  <properties>
        <android.sdk.path>
        C:\Android\android-sdk
        </android.sdk.path>
 </properties>
    <repositories>
        <repository>
            <id>com.android.support</id>
            <name>appcompat Repository</name>
            <url>https://maven.google.com</url>
            <layout>default</layout>
        </repository>
<!-- 
        <repository>
            <id>com.android.support</id>
            <name>appcompat Repository</name>
            <url>https://mvnrepository.com/artifact/com.android.support/appcompat-v7/</url>
            <layout>default</layout>
        </repository>
 -->
    </repositories>
  <dependencies>
      <dependency>
           <groupId>com.google.endpoints</groupId>
            <artifactId>endpoints-framework</artifactId>
            <version>2.2.1</version>
      </dependency>
      <dependency>
        <groupId>com.google.api-client</groupId>
        <artifactId>google-api-client</artifactId>
        <version>1.23.0</version>
    </dependency>
    <dependency>
        <groupId>com.android.support</groupId>
        <artifactId>appcompat-v7</artifactId>
        <version>28.0.0</version>
        <type>pom</type>
         <scope>compile</scope>
    </dependency>
</dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>com.simpligility.maven.plugins</groupId>
        <artifactId>android-maven-plugin</artifactId>
        <version>4.3.0</version>  
        <extensions>true</extensions>
      </plugin>
    </plugins>
    <pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-maven-plugin</artifactId>
        <version>1.9.76</version>
        <configuration>
            <!-- deploy configuration -->
        </configuration>
      </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.4.1</version>
        <configuration>
            <rules><dependencyConvergence/></rules>
        </configuration>
    </plugin>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
        <plugin>
            <groupId>org.eclipse.m2e</groupId>
            <artifactId>lifecycle-mapping</artifactId>
            <version>1.0.0</version>
            <configuration>
                <lifecycleMappingMetadata>
                    <pluginExecutions>
                        <pluginExecution>
                            <pluginExecutionFilter>
                                <groupId>
                                    com.simpligility.maven.plugins
                                </groupId>
                                <artifactId>
                                    android-maven-plugin
                                </artifactId>
                                <versionRange>[4.3.0,)</versionRange>
                                <goals>
                                    <goal>emma</goal>
                                </goals>
                            </pluginExecutionFilter>
                            <action>
                                <ignore></ignore>
                            </action>
                        </pluginExecution>
                    </pluginExecutions>
                </lifecycleMappingMetadata>
            </configuration>
        </plugin>    
    </plugins>
    </pluginManagement>
  </build>
</project>

这是我的 list :
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    android:versionCode="26" android:versionName="4.2.6" 
    package="com.topcaddie">

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>    
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>   
    <permission android:name="com.topcaddiemobile.permission.C2D_MESSAGE" 
        android:protectionLevel="signature"/>

    <uses-permission android:name="com.topcaddiemobile.permission.C2D_MESSAGE"/>
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
    <uses-permission android:name="android.permission.USE_CREDENTIALS"/>
    <uses-permission android:name="com.android.vending.BILLING" />

    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="24"/>

    <application 
        android:allowBackup="true" 
        android:icon="@drawable/golf" 
        android:label="@string/app_name" 
        android:name="com.topcaddiemobile.GolfApp" 
        android:theme="@style/Theme.Black.WActionBar"
        android:supportsRtl="true"
        >
    <!--     android:debuggable="false" -->

        <activity android:label="@string/title_activity_main" 
            android:name="com.topcaddiemobile.TermsActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
   <!--             
        <activity android:label="@string/title_activity_main" 
            android:name="com.topcaddiemobile.TermsActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        -->
        <activity android:label="@string/title_activity_main" 
            android:name="com.topcaddiemobile.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:label="@string/title_activity_main" 
            android:name="com.topcaddiemobile.PreMainActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

        <activity android:label="@string/title_activity_main" 
            android:name="com.topcaddiemobile.AccountActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

        <activity android:label="@string/title_activity_main" 
            android:name="com.topcaddiemobile.TopTabs">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:label="@string/title_activity_main" 
            android:name="com.topcaddiemobile.SettingsActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:label="@string/title_activity_main" 
            android:name="com.topcaddiemobile.CopyHoleActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:label="@string/title_activity_main" 
            android:name="com.topcaddiemobile.Hole_Play_Tabs">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:label="@string/title_activity_main" 
                android:name="com.topcaddiemobile.FragmentHolderActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
            <activity android:label="@string/player_title" 
                android:name="com.topcaddiemobile.players.PlayerViewListActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:label="@string/course_title" 
            android:name="com.topcaddiemobile.CourseListActivity"
         android:parentActivityName=".MainActivity" >
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:label="@string/course_title" 
            android:name="com.topcaddiemobile.RequestCourseActivity"
         android:parentActivityName=".MainActivity" >
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:label="@string/course_title" 
            android:name="com.topcaddiemobile.CourseWebSendActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:label="Courses on TopCaddie.com" 
            android:name="com.topcaddie.old.CourseFromWebActivity">
            &gt;
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:label="Courses on TopCaddie.com" 
            android:name="com.topcaddie.old.CourseWebActivity">
            &gt;
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:label="Courses on TopCaddie.com" 
            android:name="com.topcaddiemobile.CourseGAEWebActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:name="com.topcaddiemobile.VoiceHandler">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:name="com.topcaddiemobile.ShotStatActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:name="com.topcaddiemobile.HoleScoreActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:name="com.topcaddiemobile.AddFeatureActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:name="com.topcaddiemobile.HoleScoreEditActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:configChanges="orientation" 
            android:name="com.topcaddiemobile.HoleActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:configChanges="orientation" android:name="com.topcaddiemobile.HoleLocationActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:configChanges="orientation" 
            android:name="com.topcaddiemobile.HoleClubChoiceActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:name="com.topcaddiemobile.ScorecardActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:name="com.topcaddiemobile.ScoreActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:name="com.topcaddiemobile.shots.ShotViewListActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:name="com.topcaddiemobile.shots.ShotStatListActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        </activity>
        <activity android:name="com.topcaddiemobile.players.AddPlayerActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:name="com.topcaddiemobile.clubs.AddClubActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <service android:name="com.topcaddiemobile.GCMIntentService"/>
        <receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
                <category android:name="com.topcaddiemobile"/>
            </intent-filter>
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
                <category android:name="com.topcaddiemobile"/>
            </intent-filter>
        </receiver>

        <activity android:launchMode="singleTop" android:name="com.topcaddiemobile.RegisterActivity"/>
</application>

我没有直接引用这两个库中的任何一个,所以我不知道该怎么做才能解决此问题。
先谢谢您的帮助!

最佳答案

在 list 文件中,使用了不同的软件包名称。请更正它们。

在此,在 list 标签中:-package =“com.topcaddie”
在应用程序和 Activity 标签包中:-android:name =“com.topcaddiemobile.GolfApp”

关于android - 尝试解决在AndroidManifest.xml中检测到的重复软件包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59706748/

相关文章:

java - Maven 构建优化 - 防止在本地构建 *-fat.jar

android - 使用应用程序类作为单例

android - 代号一 - ReplaceAndWait() 不起作用?

android - Google map - "App won' t 运行,除非您更新 Google Play 服务”

java - 如何在 Eclipse 4 的默认位置获取 RCP 应用程序中的工具栏元素?

java - 在 Android 中创建 JSON

java - Eclipse Java 条件观察点

javascript - Android webview - JavaScript 回调不起作用?

java - maven webapp 和 maven 站点原型(prototype)有什么区别?

spring - 将 grails 应用程序构建为从另一个项目引用的依赖项?