如何在Library Project中导入包和类文件

问题描述 投票:4回答:3

APK大小已达到105 MB,我需要创建APK Expansion Files

我关注Android Documentation创建扩展文件。

我已经下载了Google Play APK Expansion LibraryGoogle Play Licencing Library

现在我需要将这些库添加到我的应用程序中。

我跟着documentation。它声明如下

  1. 选择文件>新建>新模块。
  2. 在Create New Module窗口中,选择Android Library,然后选择Next。
  3. 指定应用程序/库名称,例如“Google Play许可证库”和“Google Play下载程序库”,选择最低SDK级别,然后选择完成。
  4. 选择文件>项目结构。
  5. 选择Properties选项卡,在Library Repository中,从/ extras / google /目录输入库(play_licensing /用于License验证库,或者play_apk_expansion / downloader_library /用于Downloader Library)。

现在问题出现在第5步:当我在Library Repository中添加跟随路径时,它会运行Gradle构建一段时间然后什么也不做,当我重新打开Project structure时,Library Repository field中没有任何内容。

C:\用户\ DELL \应用程序数据\本地\ Android的\ SDK \演员\谷歌\ market_licensing \库

我无法理解如何将此项目导入我的应用程序。另一种方法是单独复制每个文件并将其添加到库模块中,但我不想尝试这种方法。

项目结构:

enter image description here

android performance android-layout apk-expansion-files
3个回答
1
投票

使用导入模块而不是创建。对于improrting之前的下载模块,从project.properties文件中删除“android.library.reference.1 = .. / market_licensing”行。


1
投票

在第5步,我输入了这个

<\ SDK> /extras/google/market_apk_expansion/downloader_library/AndroidManifest.xml 对于下载程序库和这个 <\ SDK> /extras/google/market_licensing/library/AndroidManifest.xml 用于许可库。

它似乎接受了这些价值观。应该删除反斜杠,但这是我能找到的唯一方法,让sdk在大于和小于内部显示。


0
投票

您可以右键单击库,并且可以选择添加为库。您可以通过右键单击libs-> add作为库将其添加为库。

© www.soinside.com 2019 - 2024. All rights reserved.