webentwicklung-frage-antwort-db.com.de

App stürzt mit Picasso ab und minifyEnabled true

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

Dies ist der Fehler, den ich beim Versuch bekam, meine release.apk zu erstellen.

Ich habe versucht, das Problem zu beheben, indem ich Folgendes hinzufügte: 

-dontwarn com.squareup.picasso.**

in meiner pro guard-rules.pro-Datei.

Die release.apk baut jetzt korrekt, zumindest scheinbar. 

Aber wenn ich die App auf meinem Telefon (oder einem anderen Telefon) installiere, stürzt sie beim Starten ab. Ich denke, wenn die Bilder mit Picasso geladen werden, denke ich.

Bitte helfen Sie mir, dieses Problem zu beheben.

Ich habe einige Lösungen aus dem Internet ausprobiert und von Ihnen vorgeschlagen, sie scheinen alle korrekt zu erstellen, aber die App stürzt immer noch ab. Könnte es von etwas anderem als den Pro-Guard-Regeln abhängen?

So sieht mein Gradle aus:

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

Sie scheinen OkHTTP immer noch zu minimieren

can't find referenced class com.squareup.okhttp

Gehen Sie zu Picassos Github-Seite

-dontwarn com.squareup.okhttp.**
36
cricket_007

probiere diese zu deiner proguard.cfg:

#### -- Picasso --
 -dontwarn com.squareup.picasso.**

 #### -- OkHttp --

 -dontwarn com.squareup.okhttp.internal.**

 #### -- Apache Commons --

 -dontwarn org.Apache.commons.logging.** 
10
xbadal

Das Hinzufügen dieser Zeile in proguard-rules.pro wurde behoben:

-dontwarn com.squareup.okhttp.**
0
Fortnite Lover

mein Problem war, dass ich mit minifyEnabled true keine signierte apk generieren konnte. Ich habe es behoben, indem ich der proguard-rules.pro-Datei Folgendes hinzugefügt habe:

#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

oder Sie können Folgendes verwenden, wenn das oben genannte immer noch Probleme verursacht:

#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
0
Mohammed Fathi

versuchen Sie dies in Ihrer App Gradle 

minifyEnabled false shrinkResources false

0
Makvin