How to resolve ProGuard warnings (notes) about missing protobuf classes when using play-services-wearable

Viewed 538

I have an android wear 2.0 project with the following dependency:

 compile 'com.google.android.gms:play-services-wearable:11.0.4' 

The play-services-wearable dependency results in an inherited dependency on play-services-basement, which contains classes such as com.google.protobuf.zzc that contain reflective code e.g:

final class zzc {
    private static Class<?> zzcrO = zzLq();

    private static Class<?> zzLq() {
        try {
            return Class.forName("com.google.protobuf.ExtensionRegistry");
        } catch (ClassNotFoundException var0) {
            return null;
        }
    }

This dependency therefore results in the following proguard Notes:

Note: com.google.protobuf.zzc: can't find dynamically referenced class com.google.protobuf.ExtensionRegistry
Note: com.google.protobuf.zzd: can't find dynamically referenced class com.google.protobuf.Extension
Note: com.google.protobuf.zze: can't find dynamically referenced class libcore.io.Memory
Note: com.google.protobuf.zze: can't find dynamically referenced class org.robolectric.Robolectric
Note: there were 4 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)

So my questions are:

  1. Do I need to include an additional dependency to prevent the ProGuard from displaying the above notes?
  2. If so, why doesn't play-services-basement include the required transitive dependencies (i.e. protobuf) automatically?
  3. Would it be safe to add '-dontnote' rules to my proguard files to hide the above warnings? I'm concerned that since this code is reflective, there's a chance that it may actually be used by google play services and cause a Runtime exception if I just ignore the problem.
0 Answers
Related