I need to create a signed APK for the Play Store. (using Android Studio) If I do this without proguard (minifyEnabled false in build.gradle), everything works fine!
If , I activate it with the default settings:
buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }
I get these warnings
:app:proguardRelease Warning: com.android.volley.error.VolleyErrorHelper$1: can't find superclass or interface com.google.gson.reflect.TypeToken Warning: com.android.volley.error.VolleyErrorHelper: can't find referenced class com.google.gson.Gson Warning: com.android.volley.error.VolleyErrorHelper: can't find referenced class com.google.gson.Gson Warning: com.android.volley.error.VolleyErrorHelper: can't find referenced method 'java.lang.reflect.Type getType()' in program class com.android.volley.error.VolleyErrorHelper$1 Warning: com.android.volley.error.VolleyErrorHelper: can't find referenced class com.google.gson.Gson Warning: com.android.volley.error.VolleyErrorHelper$1: can't find referenced class com.google.gson.reflect.TypeToken Warning: com.android.volley.error.VolleyErrorHelper$1: can't find referenced class com.google.gson.reflect.TypeToken Warning: com.android.volley.error.VolleyErrorHelper$1: can't find referenced class com.google.gson.reflect.TypeToken Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.Gson Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.Gson Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.Gson Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.JsonSyntaxException Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.JsonSyntaxException Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.Gson Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.JsonSyntaxException Warning: com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl: can't find referenced method 'long getContentLengthLong()' in program class com.squareup.okhttp.internal.huc.HttpURLConnectionImpl Warning: com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl: can't find referenced method 'long getHeaderFieldLong(java.lang.String,long)' in program class com.squareup.okhttp.internal.huc.HttpURLConnectionImpl Warning: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement Warning: okio.Okio: can't find referenced class java.nio.file.Files Warning: okio.Okio: can't find referenced class java.nio.file.Files Warning: okio.Okio: can't find referenced class java.nio.file.Files Warning: okio.Okio: can't find referenced class java.nio.file.Path Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption Warning: okio.Okio: can't find referenced class java.nio.file.Path Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement Warning: okio.Okio: can't find referenced class java.nio.file.Path Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption Warning: okio.Okio: can't find referenced class java.nio.file.Path Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement Warning: there were 28 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 3 unresolved references to program class members. Your input classes appear to be inconsistent. You may need to recompile the code. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember) 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 UP-TO-DATE :app:validateExternalOverrideSigning :app:packageRelease
And the build process stops with this message:
Error:Execution failed for task ':app:packageRelease'. > Unable to compute hash of ...\app\build\intermediates\classes-proguard\release\classes.jar
After several probes, I found a way to remove warnings with these lines in my "proguard-rules.pro":
-dontwarn com.android.volley.** -dontwarn com.squareup.okhttp.** -dontwarn okio.**
But the build process is still in error! Does anyone have a workaround for this problem?
Thanks! Davide
android apk android-build android-proguard
Davide
source share