更新到 android gradle 插件 3.5 后的 proguard 问题

编程入门 行业动态 更新时间:2024-10-12 18:23:28
本文介绍了更新到 android gradle 插件 3.5 后的 proguard 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我将某些对象的 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-15 04:33:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/857537.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:新到   插件   android   gradle   proguard

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!