Duplicate file when deploying apk

This problem seems to be suitable for several people, but I could not apply the solution proposed in other threads, for one reason or another, therefore ...

I am trying to create a simple Android application with a built-in web server. Server selection if berth. I am using maven to manage dependencies using the maven-android-plugin. I added the v8.x jetty server as a default domain dependency. When I try to deploy my apk in a sandbox, I get an error

Duplicate APK file found: about.html

So, the file in question is located in the supply package, or rather, it was found in two packages of consoles, one of which is dependent on the mooring server. Other topics there seem to suggest that I delete the file from one bank or another, but this is not a really scalable solution, since I do not own banners.

Is there a more general solution to this problem? Something that manages conflict and builds or deploys time?

I should note that I'm a bit of Java noob, and went for NetBeans and maven because it is a toolkit that I am familiar with.

+4
source share
4 answers

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

mvn android:deploy -Dandroid.extractDuplicates=true 
+4
source

There are several problems:

First, to integrate Jetty, your project will need a pom.xml file. The Android APK (as-is) does not know how to solve the Maven dependency problem without any bridge. So, you need to install several plugins for managing Pom on Eclipse. Follow the instructions here: http://rgladwell.github.com/m2e-android/ (It was easier for me to create a new project using the method described here, rather than convert an existing Android application to a Maven project, but I'm sure it will work in anyway.)

Secondly, once you have installed this, you will need to make sure that your pom.xml contains the necessary dependencies, build goals and variables. So, open your pom.xml and make sure you have the following:

  • In the "build" node:

    sourceDirectory → src

    defaultGoal -> install (I suppose ...)

  • In the "dependencies" node:

    ... all dependencies for a berth / comet (org.cometd.java, org.eclipse.jetty, etc.)

Thirdly, you should know that you cannot just press the green start button and launch the application through ADB. You should install it in maven (Run As -> Maven build / install / test / whatever)

+2
source

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

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

+1
source

I also realized that you are probably already using the android-maven plugin correctly. Another important piece of advice: change the scope to a berth. This works successfully for me, while using the default scope (compilation) always threw a duplicate file in the APK error.

0
source

Source: https://habr.com/ru/post/1380894/


All Articles