错误:执行任务失败:app:transformClassesWithMultidexlistForDebug当我使用AdCash monatisation(Android)

当我包含AdCash库( compile 'com.adcash:adcash-sdk-lib:2.4.0' )时,我有这个错误:

 Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. java.io.IOException: Can't write [C:\NovaDevelopment\xxx\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Program Files\Android\Android Studio\gradle\m2repository\org\jetbrains\annotations\13.0\annotations-13.0.jar(;;;;;;**.class)] (Duplicate zip entry [annotations-13.0.jar:org/intellij/lang/annotations/Flow.class])) 

但没有这个库,一切都按预期工作。

我的build.gradle文件:

 apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 buildToolsVersion "27.0.0" defaultConfig { applicationId "com.xxx" minSdkVersion 16 targetSdkVersion 22 versionCode 23 versionName "2.8" multiDexEnabled true } buildTypes { release { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } dexOptions { javaMaxHeapSize "4g" } packagingOptions{ exclude 'META-INF/rxjava.properties' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/notice' exclude 'META-INF/notice.txt' exclude 'META-INF/license' exclude 'META-INF/license.txt' } repositories { maven { url "https://jitpack.io" } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.googlecode.android-query:android-query:0.25.9' compile 'com.android.support:support-v4:26.1.0' compile 'com.android.support:appcompat-v7:26.1.0' compile 'com.eftimoff:android-patternview:1.0.6@aar' compile 'com.google.android.gms:play-services-ads:11.4.2' compile 'com.google.firebase:firebase-core:11.4.2' // compile 'com.flurry.android:analytics:6.9.2' compile 'com.android.support:design:26.1.0' compile 'com.jakewharton:butterknife:8.5.1' compile 'com.android.support:multidex:1.0.2' compile 'com.google.android.gms:play-services-analytics:11.4.2' compile 'com.github.chrisbanes:PhotoView:2.0.0' compile('com.smartyads:ad-container:0.4.5') { transitive = true } compile 'com.android.support.constraint:constraint-layout:1.0.2' annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile 'com.inmobi.monetization:inmobi-ads:7.0.0' compile 'com.ironsource.sdk:mediationsdk:6.7.0.1@jar' compile 'com.github.vungle:vungle-android-sdk:5.3.0' compile 'com.adcolony:sdk:3.2.1' compile 'com.adcash:adcash-sdk-lib:2.4.0' implementation files('src/lib/aerserv-sdk.jar') implementation project(':SDKAndroid') } apply plugin: 'com.google.gms.google-services' repositories { mavenCentral() } 

任何建议?

UPD

我解决这个问题,使用* .aar库的AdCash,而不是编译依赖。 希望,这有助于任何人!

 public class PreSchoolFont extends MultiDexApplication { @Override public void onCreate() { super.onCreate(); @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(PreSchoolFont.this); } } 

的Manifest.xml

  <application android:name="com.example.demo.PreSchoolFont " android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:largeHeap="true" android:theme="@style/AppBaseTheme" tools:replace="android:allowBackup,icon,theme,label">