Importing library in Android Studio

10

How to import a library into Android Studio?

I have a project in Eclipse that uses the libraries:

  • zip_file
  • library
  • downloader_library

You need to add APK Expansion Files to an application that is larger than 50MB.

The project is working normally in Eclipse, I would like to add it to Android Studio and I do not know how, I already downloaded it:

  • Google Play APK Expansion Library
  • Google Play Licensing Library
  • Android Support Library

in the Android SDK Manager.

    
asked by anonymous 16.12.2013 / 19:18

3 answers

12

In a project I'm doing I had a hard time adding Bibliotecas of type not .JAR , because for every version that Android Studio IDE updates something changes. And changing the version 0.3.0 removed options from the Project Structure menu, making it easier to one side and making it difficult for another.

I'll show you step-by-step how I did to add the zip_file package from the library: Google Play APK Expansion Library ;

Note: I used version 0.3.7 of Android Studio

  • In Android Studio go to the menu Project Structure :

  • 17.12.2013 / 17:36
    2

    If the library is a JAR do the following:

    1) Copy the JAR file to the <diretorio do projeto>/libs directory
    2) In Android Studio, in the project structure, enter the libs folder, select the library you just added, click the context menu (right mouse button) and select the option Add as Library...

    There is another way to do the same:

    1) Same step 1 above
    2) Select the File > Project Structure option (there is a shortcut button on the Configure Project Structure toolbar that does the same thing)
    3) In the window that opens, in the leftmost panel select Libraries
    4) In the middle pane, select the + button to add a new library by selecting the JAR file you copied

    In the case of the Expansion Library and the Licensing Library (which are sources), after they have been installed via the SDK Manager, go to the directory where the sources and resources of these libraries have been installed:

    On Mac you are in:

    • /Applications/Android Studio.app/sdk/extras/google/play_apk_expansion/downloader_library/src
    • /Applications/Android Studio.app/sdk/extras/google/play_apk_expansion/downloader_library/res
    • /Applications/Android Studio.app/sdk/extras/google/play_apk_expansion/zip_file/src
    • /Applications/Android Studio.app/sdk/extras/google/play_licensing/library/src
    • /Applications/Android Studio.app/sdk/extras/google/play_licensing/library/res
    Copy the contents of sources to <projeto>/src/main/java , the resources to <projeto>/src/main/res and click the Sync Project with Grade Files button.

    I hope it helps.

        
    16.12.2013 / 21:30
    1

    I do not know if this answers your question, but take a look there

    link

        
    16.12.2013 / 19:57