user3398598
user3398598

Reputation: 423

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

I've configured:

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

but still getting the warning:

 Note: the configuration keeps the entry point 'com.trusteer.trf.dex_parser { int get_strings_count(org.jf.dexlib2.dexbacked.DexBackedDexFile); }', but not the descriptor class 'org.jf.dexlib2.dexbacked.DexBackedDexFile'

I am using proguard version 4.7 (in Android SDK)

What should I do?

Upvotes: 32

Views: 20507

Answers (6)

burtsevyg
burtsevyg

Reputation: 4086

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.**  { *; }

Upvotes: 0

Sanche
Sanche

Reputation: 165

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

-ignorewarnings

Upvotes: 3

William
William

Reputation: 20196

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.

Upvotes: 33

柏渊谢
柏渊谢

Reputation: 31

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.

Upvotes: 3

Vaiden
Vaiden

Reputation: 16132

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.

Upvotes: -1

Vaiden
Vaiden

Reputation: 16132

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.

Upvotes: 0

Related Questions