5

在使用 maven 构建 Android APP 时,我在下面遇到异常

> [ERROR] Cannot add resources from
> ~/.m2/repository/com/inmobi/androidsdk/AdNetwork/3.5.4/AdNetwork-3.5.4.jar
> com.android.sdklib.build.DuplicateFileException: Duplicate files at
> the same path inside the APK  at
> com.android.sdklib.build.ApkBuilder$JavaAndNativeResourceFilter.checkEntry(ApkBuilder.java:125)
>   at
> com.android.sdklib.internal.build.SignedJarBuilder.writeZip(SignedJarBuilder.java:228)
>   at
> com.android.sdklib.build.ApkBuilder.addResourcesFromJar(ApkBuilder.java:576)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:606)     at
> com.jayway.maven.plugins.android.phase09package.ApkBuilder.addResourcesFromJar(ApkBuilder.java:292)
>   at
> com.jayway.maven.plugins.android.phase09package.ApkMojo.doAPKWithAPKBuilder(ApkMojo.java:586)
>   at
> com.jayway.maven.plugins.android.phase09package.ApkMojo.createApkFile(ApkMojo.java:356)
>   at
> com.jayway.maven.plugins.android.phase09package.ApkMojo.execute(ApkMojo.java:307)
>   at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>   at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>   at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>   at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>   at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>   at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>   at
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>   at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)   at
> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)  at
> org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)  at
> org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)   at
> org.apache.maven.cli.MavenCli.main(MavenCli.java:141)     at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:606)     at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>   at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>   at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>   at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

我已将 sdk jar(AdNetwork-3.5.4.jar) 添加到我的本地存储库中,并在我的 pom 中添加了依赖项

有谁知道如何解决这一问题 ?

4

2 回答 2

0

在您的 maven-android-plugin 尝试添加:

<extractDuplicates>true</extractDuplicates>

资源

于 2013-08-12T08:05:17.450 回答
0

我认为您的问题与存储库/依赖关系无关

com.android.sdklib.build.DuplicateFileException: Duplicate files at the same path inside the APK at

 com.android.sdklib.build.ApkBuilder$JavaAndNativeResourceFilter.checkEntry(ApkBuilder.java:125)

我怀疑上面的行是问题所在。请看那里,看看有没有错或重复

于 2013-08-12T07:59:41.337 回答