APK扩展文件:在Android Studio中指定库路径(Windows)

时间:2016-08-30 14:44:23

标签: android android-studio android-gradle android-library apk-expansion-files

我在Android Studio(Windows 10)上。我一直在尝试按照https://developer.android.com/google/play/expansion-files.html中的步骤进行操作,但我仍然坚持使用#34;准备使用下载程序库"。我已下载并安装了Google Play许可证库和Google Play下载程序库。我已经创建了相应的模块。但是当我转到模块设置并指定库存储库的路径时,我会收到错误,当我再次打开模块设置时,库存储库字段仍为空白。我得到的错误是:

10:23:57 PM IncorrectOperationException: Error while applying changes: cannot create file from text: C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_apk_expansion\downloader_library\
10:36:23 PM IncorrectOperationException: Error while applying changes: cannot create file from text: C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_licensing\library\

我指定的库存储库路径是:

C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_apk_expansion\downloader_library
C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_licensing\library\

我尝试了各种各样的事情,例如转义反斜杠,导入模块而不是单击New Modules但是没有可用的。

将不胜感激任何帮助。 TIA。

2 个答案:

答案 0 :(得分:8)

The documentation of this tutorial miss the reference of the Android Manifes.xml file on the path for each .

The correct path for each library are:

Google Play License Library <sdk>/extras/google/play_licensing/library/AndroidManifest.xml

Google Play Downloader Library <sdk>/extras/google/play_apk_expansion/downloader_library/AndroidManifest.xml

I noticed that on other tutorial from Google where use the same library for setting up the Licensing Verification Library

Tutorial for LVL

Android Library Repository

ANSWER UPDATED: These previous method only reference one file of the whole library. Actually I revert all this steps to use a library from whit all we need to use Google Play License Library and Google Play Downloader Library there is the link for the repository

答案 1 :(得分:1)

我尝试使用单个Module的build.gradle中的下面的标签。 flatDir是解决方案的关键。对于基于 Windows 的Android Studio,需要使用双'\'反斜杠转义'\'。

repositories {

     flatDir {
          dirs "C:\\Users\\<username>\\AppData\\Local\\Android\\sdk\\extras\\google\\market_licensing"
     }
}

我还在学习,但我认为它与flatDirs容器有关,它应该是存储库容器的子容器。

它现在显示有点不同但Gradle Sync正常工作。

Project Structure Dialog