为Viger-PDF添加依赖项时无法合并dex错误

时间:2018-09-10 10:47:07

标签: android

  

错误:任务执行失败   ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'

     

java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并   dex

运行android项目时发生此错误。

添加依赖项后:

implementation 'com.github.aerdy:Android-Viger_View_Pager_PDF_OpenSource:-SNAPSHOT'

app.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
    applicationId "com.trinityinfosystem.kv.mycollege"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
   }
}

repositories {
    maven { url  "http://dl.bintray.com/lukaville/maven"}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.code.gson:gson:2.8.5'

implementation 'de.hdodenhof:circleimageview:2.2.0'

implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'

implementation 'com.github.bumptech.glide:glide:4.7.1'

implementation 'com.github.ittianyu:BottomNavigationViewEx:1.2.4'
implementation 'com.github.yalantis:Side-Menu.Android:1.0.1'

implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.facebook.android:audience-network-sdk:4.99.1'
implementation 'me.relex:circleindicator:1.2.2@aar'

implementation 'com.github.aerdy:Android-Viger_View_Pager_PDF_OpenSource:-SNAPSHOT'
}

2 个答案:

答案 0 :(得分:0)

只需将其添加到defaultConfig中的build.gradle(Module:app)文件中  multiDexEnabled true和  minifyEnabled是  然后同步您的项目

答案 1 :(得分:0)

ContentProvider上添加此内容

repositories

并通过使用

启用multidex
repositories {
    maven { url  "http://dl.bintray.com/lukaville/maven"}
    jcenter() 
    maven { url 'https://jitpack.io' }
}

希望这会有所帮助。