问题
I am trying to rewrite my App to work with APK Expansion files. I have been following the documentation here http://developer.android.com/google/play/expansion-files.html . I have downloaded the ...
... but when I added this code ...
public static Uri getTrackUriFromZipFile ( int track ) {
// Get a ZipResourceFile representing a specific expansion file
ZipResourceFile expansionFile = new ZipResourceFile(filePathToMyZip);
}
... I get the error message ZipResourceFile cannot be resolved to a type
:( weep weep weep
Editted ... Hmmm maybe I have to do something awful like this ...
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). Specify a Project Name such as "Google Play License Library" and "Google Play Downloader Library" Click Finish. Note: The Downloader Library depends on the License Verification Library. Be sure to 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.
http://developer.android.com/google/play/expansion-files.html#AboutLibraries
回答1:
You need to install the Google Play APK Expansion Library extra using the Android SDK Manager. It will be installed in the <sdk>/extras/google/play_apk_expansion/
folder. (You also need the Google Market Licensing extra, if you don't have that already installed.)
The folder contains a couple of library projects: downloader_library
and zip_file
. It also contains a sample project, downloader_sample
, that is set up to use the libraries. You can use that as a pattern to setting up your own project.
The ZipResourceFile
class that you asked about is defined in the zip_file
library project.
回答2:
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). Specify a Project Name such as "Google Play License Library" and "Google Play Downloader Library" Click Finish. Note: The Downloader Library depends on the License Verification Library. Be sure to 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.
http://developer.android.com/google/play/expansion-files.html#AboutLibraries
And actually I just ignored the bit about "Specify a Prject Name such as ..." I just used the default names the gui came up with.
来源:https://stackoverflow.com/questions/15491559/zipresourcefile-cannot-be-resolved-to-a-type