android - 未知类 ILicensingService 混淆 Android 项目时的注意事项

标签 android ant proguard android-lvl

我正在尝试使用 Ant 和 ProGuard 构建 Android 版本。我取消了 project.properties 中的以下行的注释,尽管该文件中的注释指出您不应该修改它;):

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

混淆时,我得到以下注释:

[proguard] Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
[proguard] Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'

我明白为什么会这样。这些行可以在默认的 ProGuard 配置文件 (${sdk.dir}/tools/proguard/proguard-android.txt) 中找到:

-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService

我没有使用 Google 许可服务,所以这些类确实是未知的。我找到了通过更新 proguard-project.txt 来删除这些注释的解决方案:

-dontnote **ILicensingService

我的问题:这是处理这个问题的正确方法吗?在我看来,无论如何不应该默认保留这些类,因为该库对于 android 项目不是必需的。我能想到的唯一方法是将默认配置文件复制到我的项目中,删除 -keep 行并完全忽略 SDK 中的默认配置文件。这似乎也不是正确的方法。还是我遗漏了什么?

最佳答案

设置“-dontnote com.google.vending.licensing.ILicensingService”没问题。事实上,它可能是默认配置文件的一部分。

  1. 使用该库的项目可能需要 -keep 选项。
  2. 对于不使用该库的项目,-dontnote 选项可以很好地抑制关于 -keep 选项的注释。该注释只是一个温和的提醒,配置文件可能包含拼写错误,因为指定的类似乎不存在。它不会影响处理。

关于android - 未知类 ILicensingService 混淆 Android 项目时的注意事项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14461024/

相关文章:

java - Ant If/Unless 属性问题

android - 当我想要获取包抖动时,它显示 HTTP 错误 403 : Forbidden

java android 新字符串

javac 找不到符号构造函数服务

java - 如何获取ant文件中的属性数量?

intellij-idea - 如何在我的 JavaFX 的 IntelliJ 工件中集成 Proguard 混淆?

android - ProGuard 使我的应用程序崩溃

android - 即使在我通过 "export signed application package..."部署 APK 后仍保留日志记录效果

android - AutoCompleteTextView 改变下划线颜色

android - 使用 JsonReader.setLenient(true) 在第 1 行第 1 列路径 $ 接受格式错误的 JSON