Duplicate file when deploying apk

耗尽温柔 提交于 2019-12-04 11:11:49

OK, found it. The solution is to build using the following command

mvn android:deploy -Dandroid.extractDuplicates=true

There are a couple of issues:

First, to integrate Jetty, your project is going to need a pom.xml file. The Android APK (as-is) does not know how to resolve a pom with Maven dependencies without some sort of bridge. So, you'll need to install a few plugins for Pom management onto Eclipse. Follow the instructions here: http://rgladwell.github.com/m2e-android/ (I found it easier to create a new project using the method described here rather than converting my existing Android app to a Maven project, but I'm sure it'll work either way.)

Second, once you've installed this, you're going to have to make sure your pom.xml contains the necessary dependencies, build goals, and variables. So, open up your pom.xml, and make sure you have the following:

  1. In the "build" node:

    sourceDirectory -> src

    defaultGoal -> install (I suppose...)

  2. In the "dependencies" node:

    ... all the jetty/cometd dependencies (org.cometd.java, org.eclipse.jetty, etc.)

Third, you should know that you can't just click the green run button and launch the app via ADB. You have to install it the maven way (Run As -> Maven build/install/test/whatever)

You should open up your war file and check if you actually have two about.html files in there. Some time ago I had two web.xmls in my war files. If you actually have duplicates then you should try to exclude those files.

Maybe you have one file in your project and the duplicate is generated by the maven plugin.

I also just realized that you're probably already properly using the android-maven plugin. One other important tip: change the scope to runtime on the jetty dependencies. This builds successfully for me, whereas using the default scope (compile) always threw the duplicate file in APK error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!