Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App crashing with Picasso and minifyEnabled true

Tags:

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

This is the error I was getting when trying to build my release.apk.

I tried to fix it by adding:

-dontwarn com.squareup.picasso.**

in my pro guard-rules.pro file.

The release.apk now builds correctly, at least apparently it does.

But when I install the app on my phone (or any phone), it crashes at launch, I think when it starts loading the images with Picasso.

Please help me fix this problem.

I have tried some solutions found on the internet and suggested from you, they all seem to build correctly, but the app still keeps crashing. Could it depend on something else other than pro guard rules?

This is how my gradle looks like:

buildTypes {
    release {
        shrinkResources true
        minifyEnabled true
        proguardFile 'proguard-rules.pro'
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
like image 405
Daniele Avatar asked Mar 05 '17 18:03

Daniele


1 Answers

You seem to be minifying OkHTTP still

can't find referenced class com.squareup.okhttp

Head over to Picasso's Github page

-dontwarn com.squareup.okhttp.**
like image 113
OneCricketeer Avatar answered Sep 23 '22 07:09

OneCricketeer