duplicate entry: com/android/volley/AuthFailureError.class while compiling project in android studio

前端 未结 9 1933
长情又很酷
长情又很酷 2020-12-02 00:01

I am using external libraries payu money sdk and linkedin-sdk, both uses volley libraries, which while compiling project gives duplicate entry of AuthFailureError.class

相关标签:
9条回答
  • 2020-12-02 00:29

    This is an example how to exclude classes in dependencies when there is duplicate entry in gradle.

     compile ('com.google.api-client:google-api-client-android:1.17.0-rc') {
        exclude module: 'httpclient'
     }
    

    or try with your way just add some more text

    configurations {
         all*.exclude group: 'com.android.support', module: 'support-v4'
    }
    

    So, now what you have to do is

    Search CTRL+SHIFT+N in android studio for the class AuthFailureError.class See which jar contains this and remove it like above (This is just as an example/You have to figure out the duplicate class and manually remove it)

    0 讨论(0)
  • 2020-12-02 00:31

    I had the similar issue while making build on Jenkins, weirdly it was working fine on my local machine. After adding below exclude it worked both on local machine and Jenkins.

    android{
    configurations {
        all*.exclude group: 'com.android.volley'
    }}
    

    I have added configurations block to my app's build.gradle inside android section.

    If it matter's Compile SDK version is 22 and Build Tools version is 25.0.0

    This worked like a charm.

    0 讨论(0)
  • 2020-12-02 00:39

    I had this problem when I tried to generate the APK (release) and I solved it changing the linkedin-sdk build.gradle:

    From:

    dependencies {
        compile 'com.android.support:support-annotations:20.0.0'
        compile 'com.android.support:support-v4:21.0.+'
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile files('libs/volley.jar')
        androidTestCompile('junit:junit:4.12') }
    

    To:

    dependencies {
        compile 'com.android.support:support-annotations:20.0.0'
        compile 'com.android.support:support-v4:21.0.+'
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.volley:volley:1.0.0'
        androidTestCompile('junit:junit:4.12') }
    
    0 讨论(0)
提交回复
热议问题