我正在尝试使用 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”没问题。事实上,它可能是默认配置文件的一部分。
- 使用该库的项目可能需要 -keep 选项。
- 对于不使用该库的项目,-dontnote 选项可以很好地抑制关于 -keep 选项的注释。该注释只是一个温和的提醒,配置文件可能包含拼写错误,因为指定的类似乎不存在。它不会影响处理。
关于android - 未知类 ILicensingService 混淆 Android 项目时的注意事项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14461024/