usar txt tutorial studio optimize minifyenabled example como code android proguard release

android - txt - proguard tutorial



La aplicaciĆ³n se bloquea con Picasso y minifyEnabled true (5)

Pareces estar minimizando OkHTTP todavía

can''t find referenced class com.squareup.okhttp

Dirígete a la página de Github de Picasso

-dontwarn com.squareup.okhttp.**

Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.OkHttpClient Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Cache Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.OkHttpClient Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.CacheControl Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.CacheControl$Builder Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Request$Builder Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.OkHttpClient Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Call Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Response Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.ResponseBody Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Response Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.ResponseBody Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.OkHttpClient Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Cache Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.CacheControl Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.CacheControl$Builder Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Request$Builder Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Response Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Cache Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.CacheControl Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Request Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Call Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Response Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.ResponseBody Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.OkHttpClient Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.CacheControl$Builder Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.CacheControl Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Request$Builder Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Response Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.ResponseBody Warning:com.squareup.picasso.OkHttpDownloader: can''t find referenced class com.squareup.okhttp.Cache Warning:there were 52 unresolved references to classes or interfaces. Warning:Exception while processing task java.io.IOException: Please correct the above warnings first. Error:Execution failed for task '':app:transformClassesAndResourcesWithProguardForRelease''. Job failed, see logs for details

Este es el error que estaba recibiendo al intentar compilar mi release.apk.

Intenté arreglarlo agregando:

-dontwarn com.squareup.picasso.**

en mi archivo pro guard-rules.pro .

El release.apk ahora construye correctamente, al menos aparentemente lo hace.

Pero cuando instalo la aplicación en mi teléfono (o en cualquier teléfono), se bloquea al iniciar, creo que cuando comienza a cargar las imágenes con Picasso.

Por favor ayúdenme a solucionar este problema.

He intentado algunas soluciones encontradas en Internet y sugerí de ti, todas parecen funcionar correctamente, pero la aplicación sigue fallando. ¿Podría depender de otra cosa que no sean las reglas pro guardia?

Así es como se ve mi gradle:

buildTypes { release { shrinkResources true minifyEnabled true proguardFile ''proguard-rules.pro'' proguardFiles getDefaultProguardFile(''proguard-android-optimize.txt''), ''proguard-rules.pro'' }


Resuelto agregando esta línea en proguard-rules.pro :

-dontwarn com.squareup.okhttp.**


mi problema fue que no pude generar un apk firmado con minifyEnabled true y lo arreglé agregando lo siguiente al archivo proguard-rules.pro :

#for Picasso library -dontwarn okio. # JSR 305 annotations are for embedding nullability information. -dontwarn javax.annotation.** # A resource is loaded with a relative path so the package of this class must be preserved. -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase # Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java. -dontwarn org.codehaus.mojo.animal_sniffer.* # OkHttp platform used only on JVM and when Conscrypt dependency is available. -dontwarn okhttp3.internal.platform.ConscryptPlatform

o puede usar lo siguiente si lo anterior sigue causando problemas:

#for Picasso library -dontwarn com.squareup.okhttp3.** -keep class com.squareup.okhttp3.* { *;} -dontwarn okio. -dontwarn okhttp3.internal.platform.ConscryptPlatform -dontwarn javax.annotation.Nullable -dontwarn javax.annotation.ParametersAreNonnullByDefault


prueba esto en tu aplicación gradle

minifyEnabled false shrinkResources false


prueba estos a tu proguard.cfg:

#### -- Picasso -- -dontwarn com.squareup.picasso.** #### -- OkHttp -- -dontwarn com.squareup.okhttp.internal.** #### -- Apache Commons -- -dontwarn org.apache.commons.logging.**