android - ProGuard 破坏了我的 Androidplot 布局

标签 android layout proguard androidplot

我是 android 开发的新手,我知道我决定试一试 ProGuard。

在与数以千计的警告作斗争后,我设法获得了我的应用程序的稳定版本,它完全按照预期的方式运行。

所以剩下的唯一问题是 Proguard 完全破坏了我的 androidplot 的布局。

我真的不知道如何解决它,我也没有真正在网上找到类似的问题。

感谢任何类型的提示,因为我什至不知道应该从哪里开始搜索问题。

这里有两个屏幕截图(ProGuard 之前和之后):

enter image description here enter image description here

-----更新:-----

对于可能遇到相同问题的每个人:

我仍然不知道到底是什么导致了这个问题,但是从 Androidplot v1.1.0 更新到 v1.4.1 对我来说是个窍门。

最佳答案

For some situations, the default ProGuard configuration file (proguard-android.txt) is sufficient and ProGuard removes all—and only—the unused code. However, many situations are difficult for ProGuard to analyze correctly and it might remove code your app actually needs. Some examples of when it might incorrectly remove code include

使用 proguard 时,请务必检查项目中使用的所有库的文档,并在 Android 项目根级别的 proguard-rules.pro 中添加给定的 proguard 规则。

v4 的例子

-dontwarn android.support.v4.** -保持类android.support.v4.app.** { *; } -保持接口(interface)android.support.v4.app.** { *; } -保持类android.support.v4.** { *; }

对于 android plot 试试这个:

-keep class com.androidplot.** { *; }

但是你的问题不是这个库所必需的

关于android - ProGuard 破坏了我的 Androidplot 布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42300593/

相关文章:

android - 引入api level和Manifest

java - 5 秒后更改布局

android - 如果源没有更改,Proguard 是否保证提供相同的映射?

java - 为什么接口(interface)(方法名称)的实现会被混淆,即使 proguad 中存在 '-keep interface'

android - 哪些 R8 规则需要在 Google Play 商店发布后才能运行带有 libgdx 游戏的 Android 应用程序?

android - 如何在 relativelayout 中以编程方式添加 fragment

android - 如何在没有 root 的情况下使用 adb 授予权限?

WPF - 如何阻止 ItemsControl 伪网格的列在布局期间跳舞/跳跃

java - 无间距的 SWT 布局允许水平填充给定的小部件

python - PySide (Qt) - 布局不起作用