NOT_LICENSED cannot be resolved or is not a field

廉价感情. 提交于 2019-12-12 03:46:14

问题


I have been trying to follow the documentation available here:

http://developer.android.com/google/play/expansion-files.html#Preparing

I have tried to follow what it says to do ...

If you're using Eclipse, create a project for each library and add it to your app:

Create a new Library Project for the License Verification Library and Downloader Library. For each library:

  • Begin a new Android project.

  • Select Create project from existing source and choose the library from the /extras/google/ directory (market_licensing/ for the License Verification Library or market_apk_expansion/downloader_library/ for the Downloader Library).

Of course there was no market_licensing or market_apk_expansion/downloader_library/ directories so I guess that I am suppose to use the play_licensing and market_apk_expansion/downloader_library directories. :/

  • Specify a Project Name such as "Google Play License Library" and "Google Play Downloader Library" Click Finish.

  • Add the License Verification Library to the Downloader Library's project properties (same process as steps 2 and 3 below).

  • Right-click the Android project in which you want to use APK expansion files and select Properties. In the Library panel, click Add to select and add each of the libraries to your application.

So yes I have read the docs and did my best to follow them, but now I get this error ...

I am starting to think there is a bug in the latest Android SDK here is what the properties of the Downloader Lib look like right after installing and add to ecliplse ...

... so I updated it like so ...


回答1:


To correct the problem I had to remove the downloader library I had imported and then use the Android SDK manager to uninstall the "Google Play APK Expansion Library" then re-install it. Then in eclispe re-import downloader lib and then 'right click' the downloader project and remove the bad library 'market_licensing' and add the correct library 'play_licensing'




回答2:


I solved it.

In this case, the imported class Policy is basic google class.

so remove import line import java.security.Policy

and than add import line import com.google.android.vending.licensing.Policy



来源:https://stackoverflow.com/questions/15594964/not-licensed-cannot-be-resolved-or-is-not-a-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!