问题
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