如何在派生的 IMarketBillingService.java 文件中禁用 eclipse 警告?
各位, 我的 Android 应用程序目前有 1 个警告,位于 IMarketBillingService.java 文件的第 80 行,该文件是 Google 新提供的应用内购买代码的一部分。警告内容为:
IMarketBillingService.Stub.Proxy 类型中的方法 getInterfaceDescriptor() 从未在本地使用。
此文件是派生文件,不得编辑。
我意识到我可能会忽略这个警告;然而,我希望我的项目零错误和警告。我发现这是一个有用的原则,特别是在与分布式团队合作时。
有人可以告诉我如何让 eclipse 禁用/忽略这个警告吗?
谢谢。
Folks,
I have android application that presently has 1 warning, in line 80 of the IMarketBillingService.java file that is part of the in-app purchasing code newly supplied by Google. The warning reads:
The method getInterfaceDescriptor() from the type IMarketBillingService.Stub.Proxy is never used locally
This file is a derived file and may not be edited.
I realize that I may ignore this warning; however, I like to have my projects have zero errors and warnings. I find this is a helpful principle, especially when working with distributed teams.
Can someone tell me how to have eclipse disable/ignore this warning?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
请留意 Bug ID 220928 的 Eclipse 补丁。一旦运行,您可以抑制 gen 目录中的所有警告。
Look out for eclipse patch for Bug ID 220928. You could suppress all warnings from the gen directory once it is in action.
从 Juno 开始,转到 gen 文件夹的属性并选择忽略可选编译问题。
请在此处查看该错误的更广泛解释。
As of Juno, go the the properties of the gen folder and choose to Ignore optional compile problems.
See a broader explanation of the bug here.
从这个警告我假设该方法是私有方法,对吗?如果您无法编辑该文件,这意味着您无法添加 @SuppressWarnings 指令,我认为您无法禁用此指令。
(您可以更改 eclipse 中的警告设置,但我认为您不希望这样做:))
From this warning I assume that the method is a private method, right? if you can't edit the file, meaning you can't add @SuppressWarnings directive, I don't think you can disable this one.
(You can change the warnings settings in eclipse, but I don't think you want that :) )
您可以在应用程序中放置一条不执行任何操作的行(假设该方法返回一个字符串),就像
这样,但您可能会收到“垃圾未使用”警告,然后您可以对此使用 @SuppressWarnings 指令。
就我个人而言,我可以接受最初的警告,并让团队的其他成员知道“此版本生成 x 个警告,仅此而已”。
You could put a do nothing line in your app (assuming the method returns a String) like
That might do it, but then you might get a 'junk is unused' warning which you could then use a @SuppressWarnings directive on that.
Personally I could live with the original warning and let the rest of the team know that 'this build generates x warnings and no more'.
您可以在本地抑制警告。只需单击“问题”窗格中的下拉菜单,然后单击“配置内容”。然后选择“显示与下面选中的任何配置相匹配的项目”,并选中所有这些。修改标题为“项目上的错误/警告”的内容,并将范围更改为新的工作集,其中包括除 gen 文件夹之外的所有文件夹和文件。
希望这有帮助!
You can suppress the warnings locally. Just click the down menu in the Problems pane, and "Configure contents". Then select "Show items that match any configurations checked below", and check all of them. Modify the one titled "Errors/Warnings on Project" and change the scope to be a new Working Set that includes all folders and files except for the gen folder.
Hope this helps!
最正确的解决方案可能是将 IInAppBillingService.aidl 与 iabHelper 一起移动到引用的库项目中,并忽略那里未使用的私有成员,例如 参考。
像这样可以摆脱警告,同时仍然会收到实际项目中未使用的私有成员的通知。目前为
gen
启用了忽略可选编译问题
(当它有效时)。
the most proper solution might be to move the
IInAppBillingService.aidl
along with the iabHelper into a referenced library project and ignore unused private members there, for reference.like this one can get rid of the warning, while still being notified of unused private members in the actual project. currently having
ignore optional compile problems
enabled forgen
(while it works).