proguard - dupe zip entry ( after upgraded faceboo

2019-07-22 21:17发布

问题:

---SOLVED : deleted 2 lines from :app:build.gradle---

    compile files('ParseLoginUI/libs/Parse-1.9.1.jar')
    compile files('ParseLoginUI/libs/ParseFacebookUtilsV4-1.9.1.jar')

the lib comment here can be interpreted as "you need these 2 statements in your proj.root.build.gradle. Well not true. I had to delete those in order not to get 'dupe zip' errors from proguard.

--Solved--

Upgrade of parseUI library from v3 to v4 went fine til i tried to run proguard within gradle "assembleRelease" task.

Error:

:proguardRelease FAILED

FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':proguardRelease'.
    > java.io.IOException: Can't write [/home/rob/src/CastVideos-android/build/intermediates/classes-proguard/release/classes.jar] 
(Can't read [/home/rob/src/CastVideos-android/build/intermediates/exploded-aar/CastVideos-android/ParseLoginUI/unspecified/libs/Parse-1.9.1.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [Parse-1.9.1.jar:com/parse/AnonymousAuthenticationProvider.class]))

I checked proguard faqs for "dupe zip" ... I tried to figure out how the dependency tree might be handling a dupe of ./libs/Parse-1.9.1.jar in that library.

IM stuck

build.gradle...

    packagingOptions {
    exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/MANIFEST'
...
    buildTypes {

        release {        

            minifyEnabled true
            proguardFile 'proguard-android-optimize.txt'
            signingConfig signingConfigs.release
        }
...
dependencies {
    compile files('libs/android-query.0.25.10.jar')
    compile files('libs/jackson-core-lgpl-1.9.2.jar')
    compile files('libs/jackson-mapper-lgpl-1.9.2.jar')
    compile 'com.github.amlcurran.showcaseview:library:5.0.0'   
    compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
    // to get around https://code.google.com/p/android/issues/detail?id=52962, we need to
    // depend on both debug and release versions of the library
    releaseCompile project(path: '..:CastCompanionLibrary-android', configuration: 'release')
    debugCompile project(path: '..:CastCompanionLibrary-android', configuration: 'debug')
    compile project(':ParseLoginUI')
    compile files('ParseLoginUI/libs/Parse-1.9.1.jar')
    compile files('ParseLoginUI/libs/ParseFacebookUtilsV4-1.9.1.jar')
    compile 'com.facebook.android:facebook-android-sdk:4.0.1'
}

dependency graph for "release"...

...
+--- project :ParseLoginUI
|    +--- com.parse.bolts:bolts-android:1.2.0
|    \--- com.android.support:support-v4:22.0.0
|         \--- com.android.support:support-annotations:22.0.0
+--- com.facebook.android:facebook-android-sdk:4.0.1
|    +--- com.android.support:support-v4:[21,22) -> 22.0.0 (*)
|    \--- com.parse.bolts:bolts-android:1.1.4 -> 1.2.0
\--- project :..:CastCompanionLibrary-android
     +--- com.android.support:appcompat-v7:22.+ -> 22.0.0
     |    \--- com.android.support:support-v4:22.0.0 (*)
     +--- com.android.support:mediarouter-v7:22.+ -> 22.0.0
     |    \--- com.android.support:appcompat-v7:22.0.0 (*)
     \--- com.google.android.gms:play-services-cast:7.+ -> 7.0.0
          \--- com.google.android.gms:play-services-base:7.0.0
               \--- com.android.support:support-v4:22.0.0 (*)

Under project.root, the only jar files are :

./ParseLoginUI/libs/ParseFacebookUtilsV4-1.9.1.jar
./ParseLoginUI/libs/Parse-1.9.1.jar

proguard config...

-keep        class com.facebook.** { *; }
-keep        class com.parse.** { *; }
-dontwarn com.parse.**
-dontnote com.parse.**