重复的jar条目-Android

时间:2019-01-23 10:26:46

标签: android performance firebase firebase-realtime-database firebase-authentication

在构建过程中收到此警告。

  

警告:处理任务java.io.IO时发生异常:不能   写   [/Users/petrose/as_projects/MrPhone/app/build/intermediates/transforms/proguard/debug/0.jar]   (看不懂   [/Users/petrose/.gradle/caches/transforms-1/files-1.1/firebase-analytics-impl-16.2.4.aar/288ad7982e8f6024c8b5f0954f183721/jars/classes.jar(;;;;;;;**.class )]   (重复的jar条目   [com / google / android / gms / internal / measurement / eo.class]))

    apply plugin: 'com.android.application'
//apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'org.greenrobot.greendao'
//apply plugin: 'io.fabric'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    defaultConfig {
        applicationId "....."
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"


        vectorDrawables { useSupportLibrary = true }
        multiDexEnabled true
        resConfigs "en"

    }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }



    buildTypes {
        release {
            minifyEnabled true
            useProguard true    // obfuscate
            shrinkResources true

        }

        debug {
            minifyEnabled true
            useProguard true    // obfuscate
            shrinkResources false
        }
    }

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

greendao {
    schemaVersion 1
}

dependencies {

    //extLib
    implementation files('libs/YouTubeAndroidPlayerApi.jar')

    //support Lib
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.android.support:appcompat-v7:28.0.0"
    implementation "com.android.support:recyclerview-v7:28.0.0"
    implementation "com.android.support:cardview-v7:28.0.0"
    implementation "com.android.support:design:28.0.0"
    implementation "com.android.support:support-vector-drawable:28.0.0"
    implementation "com.android.support.constraint:constraint-layout:$rootProject.constraintLibraryVersion"
    implementation "com.android.support:customtabs:28.0.0"



    //Google API Client Library
    implementation('com.google.apis:google-api-services-youtube:v3-rev195-1.23.0') {
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'
        exclude group: 'com.google.guava'

    }
    implementation('com.google.api-client:google-api-client-android:1.23.0') {
        exclude group: 'org.apache.httpcomponents'
        exclude group: 'com.google.guava'

    }
//    implementation('com.google.apis:google-api-services-calendar:v3-rev309-1.23.0') {
//        exclude group: 'org.apache.httpcomponents'
//        exclude group: 'com.google.guava'
//
//    }

    // image
   //implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion"
//    implementation 'com.android.support:support-v4:27.1.1'
//    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    //annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.glideVersion"
    implementation "com.squareup.picasso:picasso:$rootProject.picassoVersion"
    implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'
    implementation 'com.commit451:PhotoView:1.2.4'

    //Network
    implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
    implementation "com.squareup.retrofit2:retrofit:$rootProject.retorfitVersion"
    implementation 'com.squareup.retrofit2:converter-scalars:2.2.0'
    implementation "com.squareup.retrofit2:converter-gson:$rootProject.retorfitVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retorfitVersion"
    implementation 'org.jsoup:jsoup:1.10.3'

    // parser
    implementation "com.google.code.gson:gson:$rootProject.gsonVersion"
    implementation 'com.fatboyindustrial.gson-jodatime-serialisers:gson-jodatime-serialisers:1.6.0'

    //parceler
    implementation 'org.parceler:parceler-api:1.1.12'
    annotationProcessor 'org.parceler:parceler:1.1.12'

    // database
    implementation "org.greenrobot:greendao:$rootProject.greenDaoVersion"
    debugImplementation "com.amitshekhar.android:debug-db:$rootProject.debugDBVersion"

    //eventBus
    implementation "org.greenrobot:eventbus:$rootProject.greenrobotVersion"

    //DI
    implementation "com.google.dagger:dagger-android:$rootProject.dagger2Version"
    annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
    implementation 'javax.inject:javax.inject:1'
    compileOnly 'javax.annotation:jsr250-api:1.0'

    // reactive
    implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjava2Version"
    implementation "com.github.miguelbcr:RxPaparazzo:$rootProject.rxRxPaparazzo"
    implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.1.1'
    implementation "com.github.akarnokd:rxjava2-extensions:0.18.7"

    //butterknife
    implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion"
    annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"

    // logger
    implementation "com.jakewharton.timber:timber:$rootProject.timberVersion"
    implementation "com.github.nisrulz:easydeviceinfo-base:$rootProject.easyDeviceInfoVersion"
    implementation 'com.github.tslamic:dn3:3.0'

    //Firebase crash analytics
    //implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'

    // facebook sdk
   // implementation "com.facebook.android:facebook-android-sdk:$rootProject.facebookAndroidSDK"
   // implementation "com.facebook.android:audience-network-sdk:$rootProject.facebookNetworkSDK"
    implementation 'com.facebook.android:facebook-login:4.28.0'
    implementation 'com.facebook.android:audience-network-sdk:5.1.0-beta'

    // google sdk
    // implementation "com.google.android.gms:play-services-analytics:$rootProject.googleLibraryVersion"
    implementation('com.google.android.gms:play-services-analytics:16.0.4') {
        exclude group: 'com.google.guava'
    }
    implementation('com.google.android.gms:play-services-ads:17.0.0') {
        exclude group: 'com.google.guava'
    }
    implementation('com.google.android.gms:play-services-auth:16.0.0') {
        exclude group: 'com.google.guava'
    }
    implementation('com.google.android.gms:play-services-gcm:16.0.0') {
        exclude group: 'com.google.guava'
    }

    // fireBase libraries
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-config:16.1.3'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.4'
    implementation 'com.google.firebase:firebase-appindexing:17.1.0'
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
    //implementation 'com.google.firebase:firebase-perf:16.2.3'
    //implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'


    //leak
    //debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
    //releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'

    //testLib
    //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'

}
apply plugin: 'com.google.gms.google-services'
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '27.1.1'
            }
        }
    }
}

//顶级构建文件

buildscript {

    repositories {
        google()
        jcenter()
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
        classpath 'io.fabric.tools:gradle:1.27.0'
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url "https://jitpack.io" }
        maven { url 'https://maven.google.com' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

1 个答案:

答案 0 :(得分:0)

在路径0.jar上准备输出jar({module}/build/intermediates/transforms/proguard/debug/0.jar)的同时,gradle复制了所有依赖库的classes.jars并在那里复制了classes.jar以形成一个中间的jar。因此,当2个不同的库依赖于一个模块时,该单个模块被复制两次,同时导致此错误。

这可以通过在正在使用该模块的库中标记compileOnly到该模块来解决。