与Dexguard混淆时保持记录 [英] Keep logging while obfuscating with Dexguard

查看:68
本文介绍了与Dexguard混淆时保持记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使Dexguard在收缩和混淆我的代码时不剥离日志记录功能.因此,我在 Dexguard 配置文件中评论了以下说明:

I am trying to make Dexguard not stripping out logging functions when it is shrinking and obfuscating my code. I have therefore commented the following instruction in Dexguard configuration file:

-assumenosideeffects类android.util.Log {...}

注释该指令后,构建将失败,并显示以下错误消息:

Once this instruction is commented, build fails with the following error message :

任务':app:dexguardRelease'的执行失败.>指令的常量索引大小无效([699742] ldc_w#65536)

我首先想到的问题是与Android 64K限制有关,但是当禁用dexguard或将其启用并设置为去除日志记录功能时,构建成功.

I have first thought that the problem was related to Android 64K limits but the build successes when dexguard is disabled or when it is enabled and set to strip out the logging functions.

dexguard是否有可能混淆诸如 Log.d()之类的功能,这些功能可能包含长字符串作为输入参数?

Is it possible that dexguard has troubles obfuscating functions like Log.d() that can contain long strings as input arguments?

谢谢

推荐答案

在该类中,您可能结合了 -encryptstrings ** 指令来使用许多调试字符串.

You probably have lots of debug strings in this class in combination with an -encryptstrings ** directive.

这将导致单个类中的大量加密字符串导致错误,如您的帖子所述.

This will lead to a large number of encrypted strings in a single class leading to errors as described in your post.

我建议您重新访问您的 -encryptstrings 规则,并仅对真正敏感的规则进行加密.

I would suggest that you revisit your -encryptstrings rules, and only encrypt the ones that are really sensitive.

这篇关于与Dexguard混淆时保持记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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