使用Proguard在Google Cloud-translate api中自动值化

时间:2019-01-30 15:48:56

标签: android google-cloud-platform android-proguard

由于我使用google-cloud-translate api进行语言翻译。

我的礼物:

 implementation('com.google.cloud:google-cloud-translate:0.5.0') {
        exclude group: 'io.grpc', module: 'grpc-all'
        exclude group: 'com.google.protobuf', module: 'protobuf-java'
        exclude group: 'org.json', module: 'json'
        exclude group: 'com.google.api-client', module: 'google-api-client-appengine'
    }

启用proguard时出现以下错误:

Warning: autovalue.shaded.com.google$.auto.service.processor.$AutoServiceProcessor: can't find referenced field 'javax.annotation.processing.ProcessingEnvironment processingEnv' in program class autovalue.shaded.com.google$.auto.service.processor.$AutoServiceProcessor
Warning: autovalue.shaded.com.google$.common.collect.$FilteredMultimapValues: can't find referenced class autovalue.shaded.com.google$.j2objc.annotations.$Weak
Warning: autovalue.shaded.com.google$.common.collect.$ImmutableMapEntrySet$RegularEntrySet: can't find referenced class autovalue.shaded.com.google$.j2objc.annotations.$Weak

为解决以上错误,我应用了以下proguard规则:

-dontwarn autovalue.shaded.com.**
-dontwarn com.google.auto.value.**
-dontwarn autovalue.shaded.com.google.**

它跳过自动值警告,并开始缩小。但以以下错误结束。

AGPBI: {"kind":"error","text":"Cannot compute meet of types: OBJECT and INT","sources":[{}],"tool":"D8"}
com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process E:\AndroidProjects\9DApps\Translator-Android_V_4_VC_1.3\Translator-Android_V_4_VC_1.3\app\build\intermediates\transforms\proguard\release\0.jar
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
    at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
    at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
    at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)

任何帮助将不胜感激。谢谢

0 个答案:

没有答案