Manu Manu - 13 days ago 11
Android Question

Error with Google Translate API (Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug, duplicate entry)

i am trying to implement language translate feature in my app, so to implement this feature i am using Gradle Dependency :"com.google.cloud:google-cloud-translate:0.5.0" after syncing the dependencies i am getting following warnings:

After Syncing
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]

Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.json:json:20151123 is ignored for debug as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.json:json:20151123 is ignored for debug as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.json:json:20151123 is ignored for release as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.json:json:20151123 is ignored for release as it may be conflicting with the internal version provided by Android.
Information:BUILD SUCCESSFUL

Information:Total time: 4.54 secs
Information:0 errors
Information:8 warnings
Information:See complete output in console

when i run the project after sync i am getting following error:

duplicate entry: com/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream.class

Errors after running my project

Information:Gradle tasks [:app:assembleDebug]

Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.json:json:20151123 is ignored for debug as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by
Android.

Warning:WARNING: Dependency org.json:json:20151123 is ignored for debug as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.json:json:20151123 is ignored for release as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.

Warning:WARNING: Dependency org.json:json:20151123 is ignored for release as it may be conflicting with the internal version provided by Android.

Warning:AndroidManifest.xml already defines debuggable (in http://schemas.android.com/apk/res/android); using existing value in manifest.

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream.class


Information:BUILD FAILED
Information:Total time: 38.0 secs
Information:1 error
Information:9 warnings
Information:See complete output in console

Answer

finally.... i solved it by doing this

  1. changing the google play services dependency version from 9.8.0 to 9.6.0.

    2.forcing google play services to install in "resolutionStrategy" section

    ie: configurations.all { resolutionStrategy { force 'com.google.android.gms:play-services:9.6.0' } }