ILicensingService 在混淆 Android 项目时注意的未知类 [英] Unknown classes ILicensingService notes when obfuscating Android project

查看:41
本文介绍了ILicensingService 在混淆 Android 项目时注意的未知类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to build an Android release with Ant and ProGuard. I uncommented the following line in project.properties, despite the comment in said file noting that you shouldn't modify it ;):

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

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

When obfuscating, I get the following notes:

[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) 中找到:

I do understand why this is happening. These lines can be found in the default ProGuard config file (${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 来摆脱这些注释的解决方案:

I'm not using the Google Licensing Service, so the classes are indeed unknown. I found a solution to get rid of these notes by updating the proguard-project.txt:

-dontnote **ILicensingService

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

My question: Is this the correct way of handling this? It seems to me that these classes shouldn't be kept by default anyway, since that lib isn't mandatory for an android project. The only way I can think of to achieve this is by copying the default config file to my project, removing the -keep lines and ignoring the default config file in the SDK completely. Which doesn't seem as the proper way to go either. Or am I missing something?

推荐答案

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

The setting "-dontnote com.google.vending.licensing.ILicensingService" is fine. In fact, it could have been part of the default configuration file.

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

这篇关于ILicensingService 在混淆 Android 项目时注意的未知类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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