- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
您好,我正在努力为我的项目创建发布版本。我已经通过 SO/Google 帮助在 Progaurd 上尝试了很多东西,但我仍然无法创建发布版本。
有人可以帮我解决这个问题吗?我总是遇到这个问题:
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
这是完整的详细错误:http://justpaste.it/perror对不起,我不得不把它作为一个链接,因为它很大。
这里是依赖:
//compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.loopj.android:android-async-http:1.4.8'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile project(':pageIndicator')
compile 'com.github.neopixl:PixlUI:v1.0.6'
compile 'com.github.bumptech.glide:glide:3.6.1'
我的 progaurd 文件:
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# 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:
-dontwarn com.google.code.**
-dontwarn org.apache.**
-dontwarn jp.wasabeef.recyclerview.**
-dontwarn com.nostra13.universalimageloader.**
-dontwarn org.acra.**
#wasabeef recyclerview
-keep class jp.wasabeef.recyclerview.** { *; }
-keepattributes Signature
#HTTP Legacy
-keep class org.apache.** { *; }
-keepattributes Signature
#Universal Image Loader
-keep class com.nostra13.universalimageloader.** { *; }
-keepattributes Signature
#Acra
-keep class org.acra.** { *; }
-keepattributes Signature
#Support libraries
-keep class com.android.** { *; }
-keepattributes Signature
# Keep the annotations
-keepattributes *Annotation*
-allowaccessmodification
-keepattributes *Annotation*
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-repackageclasses ''
-dontnote com.android.vending.licensing.ILicensingService
# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# Preserve all native method names and the names of their classes.
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
# Preserve static fields of inner classes of R classes that might be accessed
# through introspection.
-keepclassmembers class **.R$* {
public static <fields>;
}
# Preserve the special static methods that are required in all enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep public class * {
public protected *;
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keep class com.splunk.** { *; }
-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
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keep class com.splunk.** { *; }
-dontwarn rx.**
-dontwarn okio.**
-dontwarn com.squareup.okhttp.**
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
-dontwarn android.net.**
-dontwarn retrofit.**
-dontwarn retrofit.appengine.UrlFetchClient
-keep class retrofit.** { *; }
-keepclasseswithmembers class * {
@retrofit.http.* <methods>;
}
-keepattributes Signature
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
#your package path where your gson models are stored
-keep class com.ylg.others.** { *; }
最佳答案
在您的 ProGuard 文件中添加:
-ignorewarnings
喜欢:
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\Softwares\Developing\Android\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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-ignorewarnings
您不必像 com.viewpagerindicator.**
那样指定任何包,这将抑制所有警告,Gradle Console
只会说:
......
Warning: there were 4 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 2 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Note: you're ignoring all warnings!
Ignoring unused library classes...
Original number of library classes: 4237
Final number of library classes: 1317
Printing kept classes, fields, and methods...
Shrinking...
......
关于java - Android 中的 transformClassesAndResourcesWithProguardForRelease' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33994356/
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. java.io.I
我正在尝试在控制台中使用 Gradle 构建我的 Android 应用程序。但是收到关于任务':app:transformClassesAndResourcesWithProguardForRelea
在为我的发行版启用缩小功能时,出现以下错误。 Error:Execution failed for task ':app:transformClassesAndResourcesWithProguar
生成签名的 APK: Note: there were 8 unresolved dynamic references to classes or interfaces. Note: there we
我最近将 android studio 更新到 2.3 版,将构建工具更新到 25.0.2、gradle 2.3.0 和 gradle distribution 3.3,现在我在构建项目时得到了这个。
您好,我正在努力为我的项目创建发布版本。我已经通过 SO/Google 帮助在 Progaurd 上尝试了很多东西,但我仍然无法创建发布版本。 有人可以帮我解决这个问题吗?我总是遇到这个问题: Err
我正在尝试导出 apk,我想启用 Proguard,但它抛出了错误。我阅读了很多答案并尝试了但没有奏效。出现以下错误: Warning:Exception while processing task
我正在 Android 中构建一个应用程序,这是 build.gradle 文件: apply plugin: 'com.android.application' android { comp
当我尝试使用发布构建变体构建我的项目时,我收到一个错误: Information:Gradle tasks [:app:assembleRelease] :app:preBuild UP-TO-DAT
当我尝试在 Android Studio 中生成签名时,出现以下错误: Error:Execution failed for task ':app:transformClassesAndResourc
我刚刚将我的项目迁移到 gradle-experimental:0.4.0 以使用 JNI。我已按照说明 here 该项目由一个库和一个应用程序组成。我无法绕过这个错误(尝试了通常的清理和无效缓存/重
我在 React Native 中开发了我的应用程序。我想缩小和缩小我的代码。为了实现这一点,我启用了 proguard 并在 build.gradle 中添加了基于 proguard 的行 这是我的
我正在尝试签署我的应用程序以供发布并且它构建正确,但我想启用 Proguard 我收到以下错误 Error:Execution failed for task ':app:transformClass
每次我在运行我的项目时遇到这个错误。我可以做一个清洁然后再次运行,它可以工作。但这不是最佳解决方案。有什么想法吗? Error:Execution failed for task ':android:
我刚刚更新到 Android Studio 2.1.1,我正在尝试构建一个发布签名的 apk,但失败并出现以下错误。我该如何解决这个问题? ':app:transformClassesAndResou
我是使用混淆器的新手,当我在创建已签名的 api 后构建 api 时,我收到了这些警告和异常。我不知道如何解决它。 这是错误日志: Warning:okio.DeflaterSink: can't f
我正在尝试生成我的 android 应用程序的签名 apk,但任务仍然不成功,给我这个错误: Information:Gradle tasks [:app:assembleRelease] Warni
我已经为我的 Android 应用程序生成了一个 APK(作为尝试),我没有遇到任何问题,APK 已正确生成。 现在,我想在生成 APK 时混淆我的代码,所以我在 build.gradle 文件的 r
当我尝试在 android studio 1.5.1 中生成签名的 Apk 并完成有关此过程的对话框时,我遇到了此消息并中止了构建: Warning:com.squareup.picasso.
我是一名优秀的程序员,十分优秀!