我已经在我的应用程序中实现了 dexguard。当没有进行混淆时应用程序可以工作,但是当 dexguard 混淆完成时应用程序会崩溃。
它给出了错误。
由以下原因引起:android.view.InflateException:com.avanza.ambitwizhmb 中的二进制 XML 文件第 0 行:layout/2131558492:膨胀类片段时出错
Caused by: com.huawei.hms.maps.model.RuntimeRemoteException: AppId is null. Please check whether the agconnect-services.json file is added to your app project.
华为的dexguard规则是:
-keep class com.huawei.agconnect.**{*;}
-dontwarn com.huawei.agconnect.**
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep interface com.huawei.hms.analytics.type.HAEventType{*;}
-keep interface com.huawei.hms.analytics.type.HAParamType{*;}
After obfuscation hms map not able to get appid from agconnect json, best way to fix this issue, add the appid in android manifest also like this
" <meta-data
android:name="com.huawei.hms.client.appid"
android:value="appid=xxxxxx" />"
如果应用打包时使用Dexguard混淆,则需要配置以下内容:
-ignorewarnings
-keep class com.huawei.agconnect.** {*;}
-keepresourcexmlelements **
-keepresources /