Proguard - Android - 处理任务java.io.IOException时出现异常

问题描述 投票:0回答:1

我在android中使用proguard得到以下错误

Exception while processing task java.io.IOException: Can't write
    [/Users/test/app/build/intermediates/transforms/proguard/BibleSociety/debug/0.jar]
(Can't read
    [/Users/test/.gradle/caches/transforms-1/files-1.1/core-1.0.0.aar/a934e1d2a2dbe62bd324c349a93ef4b3/jars/classes.jar(;;;;;;**.class)]
(Duplicate zip entry [android/support/v4/c/c$a$a.class ==
    classes.jar:android/support/v4/os/IResultReceiver$Stub$Proxy.class]))
  :app:transformClassesAndResourcesWithProguardForcietyDebug FAILED

下面是完整的build.gradle

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

android {
    compileSdkVersion project.ext.compileSdkVersion
    buildToolsVersion project.ext.buildToolsVersion
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
         manifestPlaceholders.screenOrientation = "portrait";
         minSdkVersion project.ext.minSdkVersion
        targetSdkVersion project.ext.targetSdkVersion
        multiDexEnabled true

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

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

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }    
    dexOptions {
        javaMaxHeapSize "4g"
    }

    flavorDimensions "api"
    productFlavors {                    
    }
}

repositories {
    google()
    jcenter()
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    //library for ipay88 payment
    implementation files('libs/ipay_hosted_standard_sdk_20180514.aar')
    implementation 'com.android.support:multidex:1.0.1'
    //compile 'net.hockeyapp.android:HockeySDK:5.0.4'
    implementation project(':FloatButtonLibrary')
/*    implementation 'com.google.android.gms:play-services:8.3.0'*/
    implementation 'com.google.android.gms:play-services-maps:' + project.ext.google_play_services
    implementation 'com.google.android.gms:play-services-location:' + project.ext.google_play_services
    implementation 'com.google.android.gms:play-services-places:' + project.ext.google_play_services
    implementation 'com.google.android.gms:play-services-vision:' + project.ext.google_play_services
    implementation 'com.google.android.gms:play-services-auth:' + project.ext.google_play_services

    //implementation 'com.google.android.gms:play-services-auth:15.0.1'    
    implementation 'com.android.support:appcompat-v7:' + project.ext.supportLibVersion
    implementation 'com.android.support:design:' + project.ext.supportLibVersion
    implementation 'com.android.support:cardview-v7:' + project.ext.supportLibVersion
    implementation 'com.android.support:recyclerview-v7:' + project.ext.supportLibVersionRecycleView

    implementation 'com.google.maps:google-maps-services:0.1.20'
    implementation 'com.google.maps.android:android-maps-utils:0.5'
//    Video library.
    implementation 'com.twilio:video-android:2.1.1'

    implementation project(':library')
    implementation('com.crashlytics.sdk.android:crashlytics:2.5.3@aar') {
        transitive = true;
    }
    implementation project(':TextDrawableLibrary')

    implementation project(':richeditor')
    implementation project(':colorpickerlibrary')
    implementation project(':imageeditlibrary')
    implementation project(':sandriosCamera')
    implementation project(':colorseekbar')
    implementation('io.socket:socket.io-client:0.8.2') {
        exclude group: 'org.json', module: 'json'
    }

    implementation 'com.android.support:percent:' + project.ext.supportLibVersion

    implementation 'com.google.firebase:firebase-messaging:' + project.ext.google_play_services
    implementation 'com.itextpdf:itextg:5.5.10'
//    implementation 'com.itextpdf:itext7-core:7.1.4'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.koushikdutta.ion:ion:2.1.7'
    implementation 'com.google.android.exoplayer:exoplayer:2.6.1'
    implementation 'com.stripe:stripe-android:6.1.2'

    implementation 'io.reactivex:rxandroid:1.2.1'
    implementation 'io.reactivex:rxjava:1.3.0'
//    Facebook

    compile('com.facebook.android:facebook-android-sdk:[4,5)') {
        exclude module: 'play-services-ads'
    }
 //   compile 'com.google.android.gms:play-services-ads:11.0.2'
  //  implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
//  Twitter Core API dependency
 //   implementation 'com.twitter.sdk.android:twitter-core:3.1.1'
//  Twitter Compose API dependency required to Share images
    implementation 'com.twitter.sdk.android:tweet-composer:3.1.1'
//    Scanner
//    implementation 'com.github.liltof:AndroidScannerDemo:3.2'

//    Share BottomSheet library.
//    implementation 'com.github.Kennyc1012:BottomSheet:2.4.1'

//    Youtube
    implementation 'com.google.apis:google-api-services-youtube:v3-rev195-1.23.0'
    implementation('com.google.api-client:google-api-client-android:1.23.0') {
        exclude group: 'org.apache.httpcomponents'
    }
//    Privacy checker.
    implementation 'com.github.javiersantos:PiracyChecker:1.2.5'

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}

//start
android.applicationVariants.all { variant ->
    if (/*(variant.buildType.debuggable)*/ variant.buildType.name.equals("release")) {
        variant.outputs.all { output ->
            def versionName = variant.versionName
            def versionCode = variant.versionCode
            def flavorName = variant.flavorName // e. g. free
            def buildType = variant.buildType // e. g. debug
            def variantName = variant.name // e. g. freeDebug

            def formattedDate = new Date().format('ddMMyyyy')
            def apkName = variantName + '_' + versionName + '_' + versionCode + '_' + formattedDate + '.apk';
            outputFileName = new File("", apkName)    
        }
    }
}
//end

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

这是proguard文件

-keep class org.spongycastle.** { *; }
-dontwarn org.spongycastle.**
-keep class com.itextpdf.** { *; }
-keep class javax.xml.crypto.dsig.** { *; }
-dontwarn javax.xml.crypto.dsig.**

-keep class org.apache.jcp.xml.dsig.internal.dom.** { *; }
-dontwarn org.apache.jcp.xml.dsig.internal.dom.**
-keep class javax.xml.crypto.dom.** { *; }
-dontwarn javax.xml.crypto.dom.**
-keep class org.apache.xml.security.utils.** { *; }
-dontwarn org.apache.xml.security.utils.**
-keep class javax.xml.crypto.XMLStructure
-dontwarn javax.xml.crypto.XMLStructure
-dontwarn org.joda.convert.**
-dontwarn org.joda.time.**
-keep class org.joda.time.** { *; }
-keep interface org.joda.time.** { *; }
-keep class ch.qos.** { *; }
-keep class org.slf4j.** { *; }
-keepattributes *Annotation*
-dontwarn org.slf4j.**
-dontwarn javax.servlet.**
-dontwarn org.joda.time.**
-dontwarn org.w3c.dom.**
-dontwarn android.text.StaticLayout
 -dontwarn javax.annotation.**
-dontwarn sun.misc.Unsafe
-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**
-keep class ch.qos.** { *; }
android proguard
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.