When you create a new project Android studio will add default libraries to be able to build your application and wrap it as an .apk. There are, however, extra libraries that you may need to handle different things in your app. Some libraries that we use are the zip file expansion library and the downloader libraries.
The downloader library is used in cases where the user deletes the expansion file and we will need to redownload the file from the google play store. The library facilitates access to your google account which holds the expansion file for download using the key they generate to access it.
The zip file library is what we use to access the expansion files, since they are packaged as a zip file it will need to be extracted. What the zip file library does is basically make the file another folder where you can pull files from without extracting all the files out (this is why we zip with “level 0” or “store”).
Obtaining the libraries
On Android studio, at the top ribbon click on the SDK Manager. On the window that pops up click on the tab that says SDK tools. click the check marks for Google Play APK Expansion library and Google Play Licensing Library. Hit apply and you should begin downloading the packages to your sdk folder.
Preparing the libraries
From my experience with installing these libraries there are a couple steps that are not really mentioned anywhere else that caused me quite a bit of trouble when I was first starting out. One is that the downloader_library that was downloaded through the SDK Manager doesn’t work without first changing the module properties. This is the library that allows you to download the expansion files if they were deleted or never downloaded with your app.
The file is downloaded to your main drive (typically c:\) under c:\users\username\AppData\Local\Android\sdk\extras\google\market_apk_expansion\downloader_library
To make this module work in Android Studio you first need to go into the downloader_library directory and open the project.properties file in any document reader (I use sublime text 3).
This is what you should see
# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system use, # "ant.properties", and override values to adapt the script to your # project structure. # Project target. target=android-15 android.library=true android.library.reference.1=../market_licensing
Here is the conditional, if you go back out one directory and find the market_licensing folder where it is supposed to be then you are good to go and you can import this library to Android Studio. However, if you go out one directory and you find that the market_licensing folder is not there then you need to update the android.library.reference.1 parameter by making it point to the correct directory location.
In my case this was only one more directory out from where the default is.
# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system use, # "ant.properties", and override values to adapt the script to your # project structure. # Project target. target=android-15 android.library=true android.library.reference.1=../../market_licensing <--added extra "../" here
Note: While this seems a small and insignificant change, without it Android Studio gives me the error that the module
is not a library! This is because the reference library was not being pointed to correctly.
You can get the app for Android tables, Making Camp , free on the Google Play store.