android - Gradle 3.0 transformClassesWithStackFramesFixerForDebug 重复条目

标签 android android-studio gradle

我在这里用谷歌搜索并搜索了解决方案,但没有找到。我刚刚将我的 Android Studio 更新到 3.0,我正在尝试移植我的应用程序以使用功能模块以便能够制作即时应用程序,但是当我尝试从 Android Studio 运行该应用程序时,出现以下错误:

Error:Execution failed for task 
':app:transformClassesWithStackFramesFixerForDebug'.
> com.android.build.api.transform.TransformException: 
java.lang.RuntimeException: java.lang.RuntimeException: 
java.util.concurrent.ExecutionException: 
java.util.concurrent.ExecutionException: 
com.android.builder.utils.FileCache$FileCreatorException: 
java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF

我尝试使用 packagingOptions 排除此类文件,但显然不起作用。这是我的 build.gradle 文件:

项目build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
    compileSdkVersion = 26

    supportLib = '26.1.0'
}

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}
allprojects {
    repositories {
        jcenter()
        google()
    }
}

应用模块build.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://jitpack.io" }
    maven { url "https://s3.amazonaws.com/avocarrot-android-builds/dist" }
    maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
    maven { url "https://maven.google.com" }

    flatDir {
        dirs 'libs'
    }
}

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {

        applicationId "com.myapp.mobile"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 23004003
        versionName "4.0.0.3"
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        abortOnError false
    }

    dexOptions {
        javaMaxHeapSize "4g"
    } 


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'META-INF/rxjava.properties'
        exclude 'META-INF/MANIFEST.MF'
    }
}

dependencies {
    def mopub = '4.16.0@aar'
    def avocarrot = '4.6.0'
    def exoplayer = 'r2.2.0'
    def mobfox = '3.2.3'
    def pubnative = '2.0.4'
    def facebook = '4.+'
    def pubnativeFacebookAdapter = '2.0.2-4.22.1'
    def taboola = '1.3.1'
    def okhttp = '3.8.1'
    def okio = '1.13.0'
    def picasso = '2.5.2'
    def firebase = '11.4.0'
    def playServices = '11.4.0'
    def supportLib = '26.1.0'
    def gson = '2.8.1'
    def circleimageview = '2.1.0'
    def floatingactionbutton = '1.3.0'
    def mpAndroidChart = 'v3.0.2'
    def gridViewHeaderFooter = '1.0.12'
    def multidex = '1.0.1'
    def floatingsearchview = '2.0.3'
    def cropper = '1.0.1@aar'
    def adapterdelegates = '3.0.1'
    def rxjava = '2.x.y'
    def rxandroid = '2.0.1'
    def rxjavaAdapter = '2.3.0'
    def retrofit = '2.3.0'
    def rxbinding = '2.0.0'
    def diagonallayout = '1.0.6'
    def fabSpeedDial = '1.0.6'
    def butterknife = '8.7.0'
    def sqlbrite = '2.0.0'
    def leakcanary = '1.5.1'
    def debugDB = '1.0.1'
    def crashlytics = '2.6.8@aar'

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation files('libs/admarvel-android-sdk-core-adcolony.jar')
    implementation files('libs/libAdapterSDKMoPub.jar')
    implementation files('libs/AdMobMediationAdapter.jar')
    implementation files('libs/lsmsdkadmobmediationadapter.jar')
    implementation files('libs/MobFox-Android-AdMob-Adapter.jar')
    implementation files('libs/gcm.jar')
    implementation files('libs/achartengine-1.1.0.jar')
    implementation files('libs/comscore.jar')
    implementation files('libs/hmediaLib-1.3.0.jar')
    implementation(name:'adux-1.0.0', ext:'aar')
    implementation "com.avocarrot.sdk:mediation-sdk-nativead:$avocarrot"
    implementation "com.google.android.exoplayer:exoplayer:$exoplayer"
    implementation "com.facebook.android:audience-network-sdk:$facebook"
    implementation "com.facebook.android:facebook-android-sdk:$facebook"
    implementation "com.google.ads.mediation:facebook:$facebook"
    implementation "com.github.mobfox:MobFox-Android-SDK-Core:$mobfox"
    implementation "net.pubnative:sdk:$pubnative"
    implementation "net.pubnative:sdk.adapter.facebook:$pubnativeFacebookAdapter"
    implementation "com.squareup.okhttp3:okhttp:$okhttp"
    implementation "com.squareup.okio:okio:$okio"
    implementation "com.squareup.picasso:picasso:$picasso"
    implementation "com.android.support:cardview-v7:$rootProject.supportLib"
    implementation "com.android.support:support-v4:$rootProject.supportLib"
    implementation "com.android.support:recyclerview-v7:$rootProject.supportLib"
    implementation "com.android.support:design:$rootProject.supportLib"
    implementation "com.android.support:customtabs:$rootProject.supportLib"
    implementation "com.google.android.gms:play-services-analytics:$playServices"
    implementation "com.google.android.gms:play-services-ads:$playServices"
    implementation "com.google.android.gms:play-services-wearable:$playServices"
    implementation "com.google.code.gson:gson:$gson"
    implementation "de.hdodenhof:circleimageview:$circleimageview"
    implementation "com.melnykov:floatingactionbutton:$floatingactionbutton"
    implementation "com.github.PhilJay:MPAndroidChart:$mpAndroidChart"
    implementation "in.srain.cube:grid-view-with-header-footer:$gridViewHeaderFooter"
    implementation "com.android.support:multidex:$multidex"
    implementation "com.github.arimorty:floatingsearchview:$floatingsearchview"
    implementation "com.soundcloud.android:android-crop:$cropper"
    implementation "com.hannesdorfmann:adapterdelegates3:$adapterdelegates"
    implementation "io.reactivex.rxjava2:rxjava:$rxjava"
    implementation "io.reactivex.rxjava2:rxandroid:$rxandroid"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$rxjavaAdapter"
    implementation "com.squareup.retrofit2:retrofit:$retrofit"
    implementation "com.squareup.retrofit2:converter-gson:$retrofit"
    implementation "com.squareup.okhttp3:logging-interceptor:$okhttp"
    implementation "com.jakewharton.rxbinding2:rxbinding:$rxbinding"
    implementation "com.jakewharton.rxbinding2:rxbinding-support-v4:$rxbinding"
    implementation "com.github.florent37:diagonallayout:$diagonallayout"
    implementation "io.github.yavski:fab-speed-dial:$fabSpeedDial"
    implementation "com.google.firebase:firebase-messaging:$firebase"
    implementation "com.jakewharton:butterknife:$butterknife"
    implementation "com.squareup.sqlbrite2:sqlbrite:$sqlbrite"
    annotationProcessor "com.jakewharton:butterknife-compiler:$butterknife"
    debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary"
    releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary"
    testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary"
    debugImplementation "com.amitshekhar.android:debug-db:$debugDB"

implementation("com.crashlytics.sdk.android:crashlytics:$crashlytics") 
    {
        transitive = true
    }
    implementation(name: 'DebugSettings', ext: 'aar')

    wearApp project(':wear')
    implementation project(':myapp-base')
}


apply plugin: 'com.google.gms.google-services'

基础模块build.gradle

apply plugin: 'com.android.feature'

repositories {
    maven { url "https://maven.google.com" }
}

android {
    compileSdkVersion rootProject.compileSdkVersion
    buildToolsVersion '26.0.2'

    baseFeature true

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    api "com.android.support:appcompat-v7:$rootProject.supportLib"
    implementation fileTree(dir: 'libs', include: ['*.jar'])

//    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'
    application project(':app')
}

最佳答案

您在应用的 build.gradle 中两次包含 libs 目录

// Once
implementation fileTree(include: ['*.jar'], dir: 'libs')
// And once more, but more verbose
implementation files('libs/admarvel-android-sdk-core-adcolony.jar')
implementation files('libs/libAdapterSDKMoPub.jar')
implementation files('libs/AdMobMediationAdapter.jar')
implementation files('libs/lsmsdkadmobmediationadapter.jar')
implementation files('libs/MobFox-Android-AdMob-Adapter.jar')
implementation files('libs/gcm.jar')
implementation files('libs/achartengine-1.1.0.jar')
implementation files('libs/comscore.jar')
implementation files('libs/hmediaLib-1.3.0.jar')

这可能是您的问题的来源。确定一种包含这些内容的方式,然后让我知道这是否可行。

关于android - Gradle 3.0 transformClassesWithStackFramesFixerForDebug 重复条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47123664/

相关文章:

gradle - Gradle构建中的文件编码问题

gradle - 我的gradle buildScript不起作用

java - Gradle-编译多个项目,但未找到共享的项目类

android - 如何将超过 50 mb 的统一游戏上传到 google playstore?

android - 在移动网站上播放视频和音频的首选方法是什么?

android - Volley 不适用于 Gradle 2.0 和 Instant run

android-studio - React-native (Signed) release apk 在设备中不断崩溃

java - 从方法(可运行)计时器中获取对象

android - 在 listItem onclick Action 中实现按钮 onclick

android - 使用Android Studio,编译器错误输出在哪里?