Warnings for Android-Studio-1.2.RC Proguard in the Square Okio library help

WIth Android Studio: 1.2.RC

I included proguard in .gradle: `` ``

minifyEnabled=true 

and added these rules to my proguard-rules.pro:

 -dontwarn com.squareup.** -dontwarn okio.** 

and added these lint rules to my .gradle file:

 warningsAsErrors false abortOnError false disable 'InvalidPackage' 

`` ``

But I still get this warning when I try to run the application in debug mode:

 ``` 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 14 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) :app:proguardDebug FAILED 

`` ``

This is so weird, since I also added these rules / options to all of my library modules, which depend on OkHttp / Picasso, I don’t know where it went wrong, maybe this is an Android Studio bug? Does anyone have any clues on this issue?

I opened issue on github.

+7
android android-studio proguard square okio
source share
2 answers

Oh, I forgot to specify the proguard file for my debug build by adding the 'proguardFiles' rule to solve the problem:

  buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { debuggable false minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' applicationIdSuffix ".debug" } } 

One of those moments that you were looking for your keys, and it is right in your pocket.

+2
source share

You have disabled alerts for

 -dontwarn com.squareup.** -dontwarn okio.** 

But what about packages (as shown in your published journal)

 -dontwarn org.codehaus -dontwarn java.nio 

In any case, ignoring warnings is not a good approach.

Try to prevent these classes from being consumed like this:

 -keep public class org.codehaus.** -keep public class java.nio.** 
+19
source share

All Articles