更新到 android gradle 插件 3.5 后的 proguard 问题 [英] proguard problem after updating to android gradle plugin 3.5

查看:38
本文介绍了更新到 android gradle 插件 3.5 后的 proguard 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将某些对象的 json 表示保存为我的应用程序中的缓存.更新应用程序的每个版本后我都没有问题,并且 json 对象已正确转换为 java 对象.更新到 android gradle 插件 3.5 后(添加这一行):

I save the json presentation of some objects as cache in my app. I had no problem after updating each release of the app and json objects was correctly converted to java objects. After updating to android gradle plugin 3.5 (Adding this line):

classpath 'com.android.tools.build:gradle:3.5.0'

当我创建发布apk时,它似乎无法将json字符串转换为java对象,并且混淆的名称似乎已更改.当我将其恢复为 gradle 插件 3.4.2 时,一切正常.那么问题出在哪里,我该如何解决?

When I create the release apk, It seems that it can't convert the json string to java objects and it seems that the obfuscated names has changed. When I revert it to gradle plugin 3.4.2, everything is OK. So what is the problem and how can I fix that?

推荐答案

我应该从混淆中排除缓存的对象,但我暂时禁用了 R8 并启用了 proguard,方法是将此行添加到 gradle.属性文件:

I should exclude cached objects from obfuscating but temporarily I disabled R8 and enabled proguard, by adding this line to gradle.properties file:

android.enableR8=false

并将这一行添加到应用程序 build.gradle 文件中:

And adding this line to app build.gradle file:

useProguard true
minifyEnabled true

问题解决了.

这篇关于更新到 android gradle 插件 3.5 后的 proguard 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆