小编Nic*_*ick的帖子

如何在使用play-services-wearable时解决有关缺少protobuf类的ProGuard警告(注释)

我有一个android wear 2.0项目,具有以下依赖项:

 compile 'com.google.android.gms:play-services-wearable:11.0.4' 
Run Code Online (Sandbox Code Playgroud)

play-services-wearable依赖导致对play-services-basement的继承依赖,其中包含com.google.protobuf.zzc等包含反射代码的类,例如:

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;
        }
    }
Run Code Online (Sandbox Code Playgroud)

因此,此依赖性导致以下proguard注意:

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 …
Run Code Online (Sandbox Code Playgroud)

dependencies android protocol-buffers gradle google-play-services

6
推荐指数
0
解决办法
454
查看次数