proguard warning: the configuration keeps the entry point…but not the descriptor class

前端 未结 6 857
小鲜肉
小鲜肉 2021-01-03 18:45

I\'ve configured:

-keep ,allowoptimization,allowobfuscation,allowshrinking public class     org.jf.dexlib2.dexbacked.** {
    *;
}

but stil

相关标签:
6条回答
  • 2021-01-03 18:55

    I did some digging in the docs. You have not supplied your whole configuration file, but I'm guessing that that com.trusteer.trf.dex_parser is set to both keep and not to obfuscate.

    This means that there is a refrence from com.trusteer.trf.dex_parser to a class called org.jf.dexlib2.dexbacked.DexBackedDexFile that was either shrunk or obfuscated. This means that the link is now broken - dex_parser can't import DexBackedDexFile.

    So either disable shrinking and obfuscation for DexBackedDexFile, or allow optimization and obfuscation on dex_parser.

    0 讨论(0)
  • 2021-01-03 19:03

    From the docuemnts:

    allowshrinking Specifies that the entry points specified in the -keep option may be shrunk, even if they have to be preserved otherwise. That is, the entry points may be removed in the shrinking step, but if they are necessary after all, they may not be optimized or obfuscated

    So it appears that you need to remove the allowshrinking modifier.

    0 讨论(0)
  • 2021-01-03 19:05

    You have told Proguard to keep a certain method void foo(Bar bar); but to obfuscate the descriptor class Bar.

    This is only a problem if you are going to invoke the method from an external source as the signature will be changed by the obfuscation (if you use Proguard to obfuscate a library and then use that library in another app).

    So have the following choices:

    • Configure Proguard to also keep Bar.

    • Use the -dontnote directive to tell Proguard not to print notes like this.

    0 讨论(0)
  • 2021-01-03 19:05

    Note: the configuration keeps the entry point '...', but not the descriptor class '...' Your configuration contains a -keep option to preserve the given method (or field), but no -keep option for the given class that is an argument type or return type in the method's descriptor. You may then want to keep the class too. Otherwise, ProGuard will obfuscate its name, thus changing the method's signature. The method might then become unfindable as an entry point, e.g. if it is part of a public API. You can automatically keep such descriptor classes with the -keep option modifier includedescriptorclasses (-keep,includedescriptorclasses ...). You can switch off these notes by specifying the -dontnote option.

    0 讨论(0)
  • 2021-01-03 19:05

    In my case this problem appears when I add to build.gradle

    minifyEnable true
    

    Official instructions: https://flutter.dev/docs/deployment/android

    Bug https://github.com/flutter/flutter/issues/19250

    Sample proguard-rules.pro file:

    #Flutter Wrapper
    -ignorewarnings
    -keep class io.flutter.app.** { *; }
    -keep class io.flutter.plugin.**  { *; }
    -keep class io.flutter.util.**  { *; }
    -keep class io.flutter.view.**  { *; }
    -keep class io.flutter.**  { *; }
    -keep class io.flutter.plugins.**  { *; }
    
    0 讨论(0)
  • 2021-01-03 19:12

    Add this line in your 'proguard-rules.pro' file to fix this problem .

    -ignorewarnings
    
    0 讨论(0)
提交回复
热议问题