无法构建发布Apk Android Studio 3.0.1 Proguard-Rules

时间:2017-12-13 12:00:00

标签: android android-studio android-proguard

我正在尝试构建我的应用程序的发布apk但我无法这样做。我在使用旧的gradle和android studio之前构建了这个应用程序,我认为它是版本2.3.3。我将所有内容更新到3.0.1版本,我无法再构建应用程序了。我试过还原但它仍然导致执行失败,这与我的程序有关。

消息:

  

错误:任务':app:transformClassesAndResourcesWithProguardForRelease'执行失败。   作业失败,请参阅日志了解详情

我的progurd-rules.pro

-dontwarn okio.**
-dontwarn com.yalantis.ucrop**
-keep class com.yalantis.ucrop** { *; }
-keep interface com.yalantis.ucrop** { *; }
-keep class othercode.** { *; }
-dontwarn com.payfort.**
-keep class com.payfort.** { *; }
-keep public interface com.payfort.** {*;}
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.content.BroadcastReceiver
-keep class javax.** { *; }
-dontwarn de.keyboardsurfer.**
-keep class de.keyboardsurfer.** { *; }
-dontwarn com.google.**
-keep class com.google.** { *; }
-dontwarn org.bouncycastle.**
-keep class org.bouncycastle.** { *; }
-dontwarn commons-codec.**
-keep class commons-codec.** { *; }
-dontwarn com.victor.**
-keep class com.victor.** { *; }
-dontwarn com.shamanland.**
-keep class com.shamanland.** { *; }
-dontwarn com.android.**
-keep class com.android.** { *; }

-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

-dontwarn android.support.v4.**
-keep class android.support.v4.** { *; }
-keep interface android.support.v4.** { *; }

-ignorewarnings

的build.gradle:

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

    dependencies {
        classpath 'io.fabric.tools:gradle:1.25.1'
    }
}
apply plugin: 'com.android.application'

apply plugin: 'io.fabric'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    dexOptions {
        incremental = true
        preDexLibraries = false
        javaMaxHeapSize "4g"
    }

    defaultConfig {
        applicationId "I HAD TO REMOVE THIS BEFORE I COULD PASTE MY GRADLE HERE"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 47
        versionName "1.1.37"
        multiDexEnabled true
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    buildTypes {

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

    packagingOptions {
        exclude 'META-INF/NOTICE' // will not include NOTICE file
        exclude 'META-INF/LICENSE' // will not include LICENSE file
        exclude 'META-INF/notice'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license'
        exclude 'META-INF/license.txt'
    }

}

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

dependencies {
    compile project(':FORTSDKv1.4')
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile('com.android.support:appcompat-v7:25.3.1') {
        transitive = true;
    }
    compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true;
    }
    compile('org.apache.httpcomponents:httpmime:4.3') {
        exclude module: "httpclient"
    }
    compile('com.nispok:snackbar:2.11.+') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    compile 'com.facebook.android:facebook-android-sdk:4.26.0'
    compile 'com.android.support:multidex:1.0.2'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'org.jsoup:jsoup:1.10.2'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.google.android.gms:play-services-maps:11.6.2'
    compile 'com.google.android.gms:play-services-location:11.6.2'
    compile 'com.google.android.gms:play-services-auth:11.6.2'
    compile 'com.google.android.gms:play-services-analytics:11.6.2'
    compile 'com.google.firebase:firebase-appindexing:11.6.2'
    compile 'com.google.firebase:firebase-messaging:11.6.2'
    compile 'com.firebaseui:firebase-ui-auth:3.1.0'
    compile 'com.google.code.gson:gson:2.8.1'
    compile 'com.shamanland:fonticon:0.1.9'
    compile 'com.victor:lib:1.0.4'
    compile 'com.google.guava:guava:23.3-android'
    compile 'org.bouncycastle:bcprov-jdk16:1.46'
    compile 'commons-codec:commons-codec:1.10'
    compile 'org.altbeacon:android-beacon-library:2.9.1'
    compile 'ly.count.android:sdk:16.06.04'
    compile 'net.danlew:android.joda:2.9.9.1'
    compile 'com.azoft.carousellayoutmanager:carousel:1.2.1'
    compile 'com.squareup.okhttp3:okhttp:3.9.1'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
    compile 'id.zelory:compressor:1.0.4'
    compile 'com.yalantis:ucrop:2.2.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.rollbar:rollbar-android:0.2.1'
}

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

1 个答案:

答案 0 :(得分:1)

我能够通过在我的proguard中添加-keeppackagenames org.jsoup.nodes来解决我的问题。我不需要在之前我不确定改变了什么我甚至没有改变我的jsoup版本