Question

I just moved from Eclipse to Android Studio. In Eclipse I had a project running with facebook and jsoup libraries properly configured and working. But when I imported the project into Android Studio I got build failed. I searched a lot here but I couldn't find a solution. Here is what I got as structure today:

Workspace \TripFinder (package name)

Inside TripFinder: (4 four folders)

.gradle
.idea
facebookSDK
gradle
tripFinder

(7 seven files)

build.gradle
gradlew
gradlew.bat
import-summary
local.properties
settings.gradle
TripFinder.iml

What I think is weird is that inside tripFinder folder besides build and src folder I got build.gradle and tripFinder.iml files (It seems to me redundant). I have the same structure inside Facebook Folder.

In Files > Project Structures... I have two modules> Facebook and TripFinder modules.

Inside Facebook dependencies: com.android.tools.idea.structure.ModuleDependenciesTableItem@668baf3 inside tripFinder dependencies i put:

- admob (stopped giving me errors as was before)
- facebookSDK
- jsoup 1.7.2.jar
- jsoup 1.7.2-sources.jar
- jsoup 1.7.2-javadoc.jar

But When I try to build I got this 2 errors:

: duplicate files during packaging of APK C:\Users\Tiago\Documents\Android\Workspace_appsTMA\TripFinder\tripFinder\build\apk\tripFinder-debug-unaligned.apk

and

Execution failed for task ':tripFinder:packageDebug'.
> Duplicate files copied in APK org/jsoup/nodes/entities-base.properties
    File 1: C:\Users\Tiago\Documents\Android\Workspace_appsTMA\TripFinder\tripFinder\src\main\libs\jsoup-1.7.2-sources.jar
    File 2: C:\Users\Tiago\Documents\Android\Workspace_appsTMA\TripFinder\tripFinder\src\main\libs\jsoup-1.7.2-sources.jar

Please, if the solution is to write something into build.gradle file, tell me which one should I edit because I got three build.gradle files. One at the root folder (tripfinder), another one inside facebook folder and another one inside tripFinder folder (the nested folder in the root). Thank you guys.

If you need anything else, please, just ask I'll be help to provide it.

Was it helpful?

Solution

Duplicate files copied in APK org/jsoup/nodes/entities-base.properties

Both jsoup 1.7.2.jar and jsoup 1.7.2-sources.jar contain org/jsoup/nodes/entities-base.properties, try removing jsoup 1.7.2-sources.jar from your build path and rebuild again.

OTHER TIPS

The doc does not show? In that case you can try removing jsoup 1.7.2-sources.jar, and enter the Jsoup.connect object, and android studio will notify you to download Java 5.0. Then the doc can show.

you can add this.

packagingOptions {
    exclude 'org/jsoup/nodes/entities-full.xml'
    exclude 'org/jsoup/nodes/entities-full.properties'
    exclude 'META-INF/maven/org.jsoup/jsoup/pom.xml'
    exclude 'META-INF/maven/org.jsoup/jsoup/pom.properties'
    exclude 'org/jsoup/nodes/entities-base.properties'
    exclude 'org/jsoup/nodes/entities-base.xml'
}

but Jsoup will error, although can compile finish. so don't do this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top