问题
I have enabled minifyEnabled true in build.grade .
[...]
Information:Gradle tasks [:app:assembleRelease]
Warning:com.caverock.androidsvg.SVGImageView: can't find referenced class com.caverock.androidsvg.R$styleable
Warning:com.caverock.androidsvg.SVGImageView: can't find referenced class com.caverock.androidsvg.R
Warning:there were 3 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)
Exception while processing task
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:473)
at proguard.ProGuard.initialize(ProGuard.java:233)
at proguard.ProGuard.execute(ProGuard.java:98)
at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:137)
at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:113)
at com.android.builder.tasks.Job.runTask(Job.java:48)
at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
at java.lang.Thread.run(Thread.java:745)
:app:dexRelease
:app:validateExternalOverrideSigning
:app:packageRelease FAILED
Error:Execution failed for task ':app:packageRelease'.
> Unable to compute hash of /Users/sanjay/Desktop/android_project/RestaurantApp/app/build/intermediates/classes-proguard/release/classes.jar
Information:BUILD FAILED
[...]
回答1:
I had the same issue and read somewhere a workaround to this issue and it was to disable minifyEnabled, generate signed APK.
buildTypes {
release {
minifyEnabled false
shrinkResources true
proguardFiles 'proguard-project.txt'
}
I never face this issue before updating buildTool to 23.0.
Also, with this newer version, you need to add this to your Progaurd.txt file.
-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**
Hope this helps to resolve your issue too.
来源:https://stackoverflow.com/questions/32798394/classes-jar-not-found-after-using-proguard-in-android-studio