Getting Warnings With Proguard (With External Libraries)

青春壹個敷衍的年華 提交于 2019-11-28 05:13:00

When you use ProGuard you have to always resolve all warnings.

These warnings tell you that the libraries reference some code and there are no sources for that. That might and might not be ok. It depends if the problematic code ever get called.

In this case warnings for Okio and Retrofit2 can be ignored. Package java.nio.* isn't available on Android and will be never called. You can safely ignore those warnings. Also Java 8 classes won't be used.

Add this to your ProGuard configuration, it should fix your problem:

-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8

Retrofit page has noted about the proguard build:

Platform calls Class.forName on types which do not exist on Android to determine platform.

-dontnote retrofit2.Platform

Platform used when running on Java 8 VMs. Will not be used at runtime.

-dontwarn retrofit2.Platform$Java8

Retain generic type information for use by reflection by converters and adapters.

-keepattributes Signature

Retain declared checked exceptions for use by a Proxy instance.

-keepattributes Exceptions

check it here: http://square.github.io/retrofit/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!