简体   繁体   English

使用Google Analytics和odfuscation时生成错误

[英]Build error when use Google Analytics and odfuscation

I have this error at android: 我在android上遇到此错误:

Execution failed for task ':app:transformClassesWithAndroidGradleClassShrinkerForDebug'. 任务':app:transformClassesWithAndroidGradleClassShrinkerForDebug'的执行失败。

ProGuard configuration parser error: C:\\Users\\user.gradle\\caches\\transforms-1\\files-1.1\\play-services-base-11.8.0.aar\\6c960bd35f12660f\\proguard.txt line 3:88 no viable alternative at input '' ProGuard配置解析器错误:C:\\ Users \\ user.gradle \\ caches \\ transforms-1 \\ files-1.1 \\ play-services-base-11.8.0.aar \\ 6c960bd35f12660f \\ proguard.txt第3行:88在输入处没有可行的选择''

This occurs when using minifyEnabled true and shrinkResources true 使用minifyEnabled trueshrinkResources true时会发生这种情况

I try keeping same files in proguard-rules but it doesn't work 我尝试在proguard-rules中保留相同的文件,但不起作用

-keep public class com.google.android.gms.* { public *; }

-dontwarn com.google.android.gms.**

-libraryjars /libs/libGoogleAnalytics.jar

-keep class com.google.android.apps.analytics.**{ *; }

Thanks!! 谢谢!!

You have to add configuration to turn on ProGuard . 您必须添加配置才能打开ProGuard Doing so will at least work. 这样做至少会起作用。

buildTypes {
        release {
            debuggable false
            minifyEnabled true
            useProguard true
            ...
        }
        debug {
            debuggable true
            minifyEnabled true
            useProguard true
            ...
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM