Getting Warnings With Proguard (With External Libraries)

后端 未结 2 618
春和景丽
春和景丽 2020-12-08 06:18

I have enabled Proguard, and i\'m trying to build the APK, and i\'m getting a lot of warnings and don\'t know how to solve them .

I\'m using Retrofit, Jsoup and othe

相关标签:
2条回答
  • 2020-12-08 06:54

    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/

    0 讨论(0)
  • 2020-12-08 07:11

    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
    
    0 讨论(0)
提交回复
热议问题