Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ProGuard unresolved reference in Shrinker Config file

Each of these lines in the Proguard file

-keep class android.webkit.** { *; }
-keep class com.facebook.ads.internal.** { *; }
-keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {*;}

produces an Android Shrinker error:

Unresolved class name / unresolved reference in Shrinker Config file

How can these errors be fixed?

(I'm using Android Api 29 and AndroidStudio 4.0.)

Edit: When I replace the '**' wildcard by just '*', the first two error messages are gone. Also, when the '$' is replaced by a dot, the subclass AdvertisingIdClient$Info is found.

Maybe it is a bug in Android Shrinker.

unresolved class name

like image 291
activity Avatar asked May 03 '20 07:05

activity


People also ask

What is ProGuard Dontwarn?

-dontwarn [class_filter] Specifies not to warn about unresolved references and other important problems at all. The optional filter is a regular expression; ProGuard doesn't print warnings about classes with matching names. Ignoring warnings can be dangerous.

How to ignore warnings in ProGuard?

There is no option to switch off these warnings. The standard Android build process automatically specifies the input jars for you. There may not be an easy way to filter them to remove these warnings. You could remove the duplicate resource files manually from the input and the libraries.

What is ProGuard configuration?

ProGuard is a tool to help minify, obfuscate, and optimize your code. It is not only especially useful for reducing the overall size of your Android application as well as removing unused classes and methods that contribute towards the intrinsic 64k method limit of Android applications.


1 Answers

This is a bug that came with Android Studio 4.0 : https://issuetracker.google.com/issues/153616200

It hasn't been resolved yet, but you can temporarily remove the warning by adding

#noinspection ShrinkerUnresolvedReference

at the beginning of your Proguard file.

like image 181
Denis Avatar answered Oct 24 '22 02:10

Denis