Software Archive
Read-only legacy content

building error

walaa_y_
Beginner
344 Views

I'm developing an app , and recently it gives me a building error for android apk build ,

could any one help me , please ?

bellow is a part of error log

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformResourcesWithMergeJavaResForArmv7Release'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties
  	File1: /home/builduser/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.8.0/5a11f020cce2d11eb71ba916700600e18c4547e7/okhttp-3.8.0.jar
  	File2: .../cordova_project/platforms/android/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/10.2.6/jars/classes.jar


* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 9.062 secs
PREDEX CACHE HITS:   0
PREDEX CACHE MISSES: 16
Stopped 0 compiler daemon(s).
Error: Error code 1 for command: .../cordova_project/platforms/android/gradlew with args: cdvBuildRelease,-b,.../cordova_project/platforms/android/build.gradle,--no-daemon,-Pandroid.useDeprecatedNdk=true,--info

 

0 Kudos
3 Replies
PaulF_IntelCorp
Employee
344 Views

Please ATTACH the full detailed build log as a TXT or LOG file to this forum thread. Please do not paste the entire log into a forum post, it is extremely difficult to help you if you do that. Use the "attach files to post" link below the forum edit window to attach your build log.

0 Kudos
walaa_y_
Beginner
344 Views

 this is the error log

0 Kudos
PaulF_IntelCorp
Employee
344 Views

It appears as if you've got a conflict between plugins, trying to use different versions of the same library. I don't know which plugins are causing this problem (assuming I am correct), but it is likely one of your third-party plugins. Any plugin that is trying to use the Google Play Services library (that appears to be the problem library, which is quite common).

I recommend that you first remove all third-party plugins from your project (you can leave the "core" Cordova plugins in, since none of those use the Google Play Services library) and see if it builds properly (obviously, it may not run properly, but getting it to build properly is the first step). Then add back each third-party plugin, one at a time, until you find the one that causes the conflict. From there, you'll have to figure out which other plugin that problem plugin is conflicting with and then have to decide which you need more or find an alternative that will not result in a conflict.

This kind of conflict is usually caused by plugins that bring in the JAR version of the play services library, rather than using Maven to bring the library in. The Maven approach makes it simpler to share common libraries between plugins without causing this sort of a problem.

Also, since our build system will be retired in a month, I highly recommend that you start learning how to build with PhoneGap Build or Cordova CLI.

0 Kudos
Reply