I need to use OAuth
protocol in my Android application. I decided to use android-oauth-client. In my build.gradle
file I have:
dependencies {
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.wu-man:android-oauth-client:0.0.3'
}
Sync project with gradle files works fine, but when I try to build my application, there is a problem:
Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_51\bin\java.exe'' finished with non-zero exit value 2
I found that I should try to add multiDexEnabled true
in defaultConfig
section in build.gradle
. The first problem is solved, but there is another one:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. java.util.zip.ZipException: duplicate entry: android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl.class
I have no idea how can I fix it and how can I build my project. Can you help me, please? Thanks in advance.
The support-v4 transitive dependency is being added twice. You can verify it using either dependencies task or dependency insight report:
or:
Where demo is the root directory of your project. The output for compile configuration will be:
And the output of dependency insight report will be:
Note that both appcompat-v7 and android-oauth-client depend on support-v4. You can easily solve it by excluding the android-oauth-client's dependency: