square/okio

Proguard with okio

moallemi opened this issue · 12 comments

Hi,
when I come to proguard my project this error occurs:

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

how can I solve the problem?

You can safely ignore the warnings. They aren't used when not available.

thanks.
this solved my problem:

-dontwarn okio.**

Hey @moallemi ,
How are you able to tell when a class isn't used when not available....Did you did through the entire source code???

Is there anyway this could be fixed so we don't have to use -dontwarn?

No. The problem is in the Android platform's lack of these types, not this library.

h4h13 commented

@moallemi Thanks

So good!-dontwarn xxx** can ignore “can't find referenced class com.xxx.xxx””warnings. But warnings arenot err,why it can't continte?
I am also "醉了"。And 围观android‘s ’"洪荒大牛"——JakeWharton.

如果你使用是okhttp和rxAndroid,retrofit2。并且在打release包是报找不到okio,rx,retrofit。你只需要在app下的proguard-rules.pro混淆文件中加入
-dontwarn org.codehaus.**
-dontwarn java.nio.**
-dontwarn java.lang.invoke.**
-dontwarn rx.**
即可

-dontwarn okhttp3.**
-dontwarn okio.**

thanks for ur suggestions,my problem is solved。

-dontwarn org.codehaus.**
-dontwarn okio.**

Thanks!

thank you moallemi
Your variant resolved my problem :)