Search code examples
androidsigned-apk

Generate signed APK error


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'
    }
}

Solution

  • You can check whether you have not missed any proguard settings for third pary libraries you use. For the extended list of proguard rules for libraries you can check here: Android Proguard Snippets