1

i try to generate apk and get this error :

Error:Execution failed for task':transformClassesAndResourcesWithProguardForRelease'.

Does anybody knows what i'm need to do the generate the apk the is my build.gradle file:

buildscript {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        jcenter()
        mavenCentral()
    }
}

apply plugin: 'com.android.application'

//Explain the libraries we use.
dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.google.android.gms:play-services:3.2.65'
    compile 'com.android.support:support-v4:23.1.+'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile files('libs/PDFNet.jar')
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile "com.squareup.picasso:picasso:2.4.0"
    compile 'com.devbrackets.android:exomedia:3.0.1'
    compile 'com.viewpagerindicator:library:2.4.1@aar'
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
//            proguardFile 'D:/Development/kalsefer/trunk/AndroidTronReader/playstore.kalsefer.keystore'
        }
    }
    lintOptions {
        checkReleaseBuilds false
        // If true, stop the gradle build if errors are found
        abortOnError false
    }

    splits {
        abi {
            enable true
            reset()
            include 'armeabi', 'armeabi-v7a', 'x86', 'x86_64' //select ABIs to build APKs for
            universalApk true //generate an additional APK that contains all the ABIs
        }
    }

    // map for the version code
    project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'x86': 3, 'x86_64': 4]

    android.applicationVariants.all { variant ->
        // assign different version code for each output
        variant.outputs.each { output ->
            output.versionCodeOverride =
                    project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) * 1000000
        }
    }
    android {
        useLibrary 'org.apache.http.legacy'
    }
}
4

2 回答 2

0

您可以检查您是否没有错过您使用的第三方库的任何 proguard 设置。有关库的 proguard 规则的扩展列表,您可以在此处查看: Android Proguard Snippets

于 2016-09-13T15:07:30.280 回答
-1
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-dontshrink

-dontwarn android.support.v4.**
-dontwarn com.google.android.gms.**

#Obfuscate settings
-dontobfuscate

#Optimization settings
#-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-dontoptimize
#-optimizations !field/removal/writeonly,!field/marking/private,!class/merging/*,!code/allocation/variable

-keepparameternames
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod


-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService


-keep public class com.kalsefer.app.ui.BrowserActivity
-keep public class com.kalsefer.app.ui.BrowserActivity$IJavascriptHandler
-keep public class com.kalsefer.app.ui.BrowserActivity$DownloadBookDRM
-keep public class com.kalsefer.app.ui.BrowserActivity$DownloadBook
-keep public class * implements com.kalsefer.app.ui.BrowserActivity$IJavascriptHandler

-keepclassmembers class com.kalsefer.app.ui.BrowserActivity$IJavascriptHandler { 
    <methods>; 
}

-keepnames public class com.kalsefer.app.reader.** {
  public protected private *;
}

-keepclasseswithmembers public class com.kalsefer.app.reader.BookReader {
  public protected private *;
  private native <methods>;
}

-keepclasseswithmembers public class com.kalsefer.app.reader.DocumentManager {
  public protected private *;
  private native <methods>;
}

-keepclasseswithmembers public class com.kalsefer.app.reader.MarkInfo {
  public protected private *;
}

-keepclasseswithmembers public class * {
    public protected private *;
}


-keepclasseswithmembers class * {
    private native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}

-keep class pdftron.PDF.PDFViewCtrl$RenderCallback { *; }
-keep class pdftron.PDF.PDFViewCtrl$PrivateDownloader { *; }
-keep class pdftron.PDF.PDFViewCtrl$LinkInfo { *; }
-keep class pdftron.Filters.CustomFilter$CustomFilterCallback { *; }
-keep class pdftron.PDF.ProgressMonitor { *; }
-keep class pdftron.SDF.ProgressMonitor { *; }
于 2016-09-13T14:55:23.070 回答