I am getting the following error when trying to build an .apk on to a phone using android studio:
:app:transformResourcesWithMergeJavaResForDebug FAILED
:app:transformResourcesWithMergeJavaResForDebug FAILED
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.google.code.ksoap2-android/ksoap2-android-assembly/pom.properties
File1: /home/me/project/android-proj/app/libs/easywsdl/ksoap2-android-assembly-3.6.1-jar-with-dependencies.jar
File2: /home/me/project/android-proj/app/libs/easywsdl/ExKsoap2-1.0.1.6.jar
The context is that I am using a bunch of easywsdl autogenerated code for communication with a web service. I just made some mods to the web service so had to regenerate the easywsdl code. This seemed to pull in a new dependency, ksoap2-android-assembly-3.6.1-jar-with-dependencies.jar whereas previously it was ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar
I have been into the build.gradle file and commented out the dependency on the prev .jar file i.e.
dependencies {
compile 'com.android.support:support-v4:18.0.0'
// compile files('libs/easywsdl/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
compile files('libs/easywsdl/ExKsoap2-1.0.1.6.jar')
compile files('libs/easywsdl/ksoap2-android-assembly-3.6.1-jar-with-dependencies.jar')
}
UPDATE
reading the error msg a bit more carefully and thinking about it a little, I looked into the .jar files and noticed the following file:
META-INF/maven/com.google.code.ksoap2-android/ksoap2-android/pom.properties
is present in both
ksoap2-android-assembly-3.6.1-jar-with-dependencies.jar
and
ExKsoap2-1.0.1.6.jar
and the contents of that file are identical in both instances
I also noticed that META-INF/maven/com.google.code.ksoap2-android/ksoap2-android/pom.properties
was also present in ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar
(the previous .jar file used when everything was working) so my thinking is that ExKsoap2-1.0.1.6.jar
has changed and now erroneously includes a duplicate of this file
If I can remove this file from ExKsoap2-1.0.1.6.jar
then maybe it will fix the issue. No idea how to do that yet though..
UPDATE 2
This has now been fixed by the following mod to the build.gradle
file:
dependencies {
compile 'com.android.support:support-v4:18.0.0'
// compile files('libs/easywsdl/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
compile files('libs/easywsdl/ExKsoap2-1.0.1.6.jar')
// compile files('libs/easywsdl/ksoap2-android-assembly-3.6.1-jar-with-dependencies.jar')
}
i.e. comment out all ksoap related dependencies other than ExKsoap2-1.0.1.6.jar