Paytabs android 集成- 程序类型已存在:okhttp3.Authenticator

Paytabs android integration- Program type already present: okhttp3.Authenticator

我在我的项目中集成了 PayTabs 付款逍遥法外 它 运行 在我的调试版本上是正确的

然后从我的项目生成签名 apk 时出现此错误

this error appear when generate sign apk

这是我的gradle依赖

implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:gridlayout-v7:26.1.0'
implementation 'com.android.support:multidex:1.0.1'

implementation 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
implementation 'com.google.code.gson:gson:2.6.1'
implementation 'com.github.fccaikai:AndroidPermissionX:1.0.0'
implementation 'com.googlecode.android-query:android-query:0.25.9'

implementation 'com.wang.avi:library:2.1.3'
implementation 'com.github.rrsystems:utilsplus:1.1.0'
implementation 'com.romandanylyk:pageindicatorview:0.0.7'
implementation 'com.github.ragunathjawahar:android-saripaar:android-saripaar-2.0.3'


implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'jp.wasabeef:picasso-transformations:2.2.1'
implementation 'com.github.chrisbanes:PhotoView:1.3.1'
implementation 'com.facebook.fresco:fresco:1.8.0'
implementation 'com.github.stfalcon:frescoimageviewer:0.5.0'

implementation 'com.intuit.sdp:sdp-android:1.0.4'
implementation 'com.intuit.ssp:ssp-android:1.0.4'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'io.nlopez.smartlocation:library:3.3.1'

implementation project(':PayTabs_SDK')

经过长时间的研究,我也遇到了同样的问题幸运的是我找到了解决方案,这里是

configurations {
   all*.exclude group: 'com.squareup.okio'
   all*.exclude group: 'com.squareup.okhttp3'
   all*.exclude group: 'com.android.support', module : 'support-v13'
}

只需将此代码放在应用程序文件夹 build.gradle 文件中,它看起来像

configurations {
    all*.exclude group: 'com.squareup.okio'
    all*.exclude group: 'com.squareup.okhttp3'
    all*.exclude group: 'com.android.support', module : 'support-v13'
}

dependencies {

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.squareup.retrofit2:retrofit:2.2.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
    implementation project(':paytabs_SDK')
}

Paytabs SDK正在使用okhttp jar文件,您可以通过配置排除okhttp

android {
   configurations {
        all*.exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    } 
}

https://github.com/JakeWharton/picasso2-okhttp3-downloader/issues/1#issuecomment-413993079