我花了5个小时尝试使用Android Studio构建一个已签名的APK android但仍然遇到此错误:
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
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.+'
}
# 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 *;
}
http://wmdemos.com/log/log.txt
感谢。
答案 0 :(得分:0)
如果您的应用中未启用minify
,则可以将其设为假。
只需改变:
minifyEnabled true
到
minifyEnabled false
然后它将生成签名的apk。