I can't figure out how to add Downloader Library and Licensing Library to Android Studio

前端 未结 4 1029
庸人自扰
庸人自扰 2021-02-05 13:56

I\'m trying to use Google\'s Downloader Library and Application Licensing Service since my app is going to use APK Expansion. But the problem is I don\'t know how to add those 2

相关标签:
4条回答
  • 2021-02-05 14:28

    For anyone else coming along with similar problem.

    I solved it by importing module (File->New->Import Module) and selecting the licensing and the downloader library folders each time.

    Note however that the .project file for downloader has a line that throws Android off (correctly):

    android.library.reference.1=../market_licensing
    

    Remove this line and the module imports fine.

    Thank you Google once again for your clear instructions and clean environment!!!

    BTW: What the heck are they writing in their guide http://developer.android.com/google/play/expansion-files.html#AboutLibraries

    "Select the Properties tab and in Library Repository, enter the library from the /extras/google/ directory (play_licensing/ for the License Verification Library or play_apk_expansion/downloader_library/ for the Downloader Library)."

    Does that even make any sense to anyone?!

    0 讨论(0)
  • 2021-02-05 14:33

    I solved the problem in a very weird way.

    I noticed that I can't import those 2 libraries directly to Android Studio because they are missing a lot of project files and therefore Android Studio doesn't recognize them as libraries.

    I then imported both libraries to Eclipse so that everything neccessary was generated and then exported them directly to Android Studio.

    That worked like a charm.

    Maybe a weird way to import a library but at least it worked.

    0 讨论(0)
  • 2021-02-05 14:37

    When I tried to import library, I met same issue, and I could resolve by adding 'include ':library-directory-name'

    1. copy your library directory into your project
    2. add "include ':library-directory-name'" in settings.gradle file same as include ':app'
    0 讨论(0)
  • 2021-02-05 14:52

    I just wanted to add a comment that the .project file for downloader should point to correct dependency:

    android.library.reference.1=../../market_licensing/library
    

    Now importing downloader will also import licensing which depends and create the correct dependency.

    EDIT: That libraries are rather old. I've found new versions here:

    https://github.com/google/play-apk-expansion

    https://github.com/google/play-licensing

    0 讨论(0)
提交回复
热议问题