简体   繁体   English

生成签名APK Android时出错

[英]Error when generate signed APK Android

I spent 5 hours trying to build a signed APK android using Android Studio but still got this Error: 我花了5个小时尝试使用Android Studio构建一个签名的APK android但仍然遇到此错误:

Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.

My gradle File 我的gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.3"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.myapp.xxx.yyy"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    testCompile 'junit:junit:4.12'


    compile project(':externallibs:libraryMaskLayout')
    compile project(':externallibs:library_gellaryfinal')
    compile project(':externallibs:libraryColorPickrBest')
    compile project(':externallibs:lib_TwoWayGrid')

    compile 'com.android.support:cardview-v7:24.2.0'
    compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'
    compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'jp.wasabeef:picasso-transformations:2.1.0'
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    compile 'com.android.support:design:24.2.0'
    compile 'com.android.support:support-v4:24.2.0'
    compile 'cn.pedant.sweetalert:library:1.3'
    compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
}

My proguard-rules.pro 我的proguard-rules.pro

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

-keep class com.myapp.xxx.yyy.** {
 *;
}
-dontwarn com.squareup.okhttp.**

-keep class com.myapp.xxx.yyy.bost.** {
 *;
}
-keep class com.myapp.xxx.yyy.edit.** {
 *;
}
-keep class com.myapp.xxx.yyy.gellery_action.** {
 *;
}
-keep class com.myapp.xxx.yyy.prefrence.** {
 *;
}
-keep class com.myapp.xxx.yyy.new_sticker.** {
 *;
}

-keepattributes InnerClasses
-dontoptimize

-dontnote com.google.vending.licensing.ILicensingService
-dontnote android.support.v4.app.NotificationCompatJellybean
-dontnote com.google.android.gms.internal.zzry
-dontwarn com.viewpagerindicator.**


-keep public class com.android.vending.licensing.ILicensingService
-keep class com.google.android.gms.** {
   public *;
}

-dontnote afzkl.development.colorpickerview.**
-dontnote cn.finalteam.galleryfinal.**
-dontnote com.davemorrissey.labs.**
-dontnote com.jess.ui.**
-dontnote com.squareip.picasso.**
-dontnote jp.co.cyberagent.android.gpuimage.**
-keep class cn.pedant.SweetAlert.Rotate3dAnimation {
    public <init>(...);
 }
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}

Thelog file 日志文件

http://wmdemos.com/log/log.txt http://wmdemos.com/log/log.txt

Thanks. 谢谢。

If you doesn't require minify enabled in your App then you can make it false. 如果您的应用程序中不需要启用minify ,则可以将其设为false。

Just change: 只是改变:

minifyEnabled true

to

minifyEnabled false

then it will generate signed apk. 然后它将生成签名的apk。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM