简体   繁体   English

在另一个项目中包含APK

[英]Including an APK in another project

如何在Android Studio中的项目中添加APK作为依赖项?

You can't do that. 你不能那样做。 Acceptable types are .jar and .aar and internal library project module. 可接受的类型为.jar.aar以及内部库项目模块。

Best you can do is to change the app-module to library module and then include it as depenancy. 最好的办法是将应用程序模块更改为库模块,然后将其作为依赖项。

You can achieve it as follows: 您可以通过以下方式实现它:

  1. Open the module-level build.gradle file. 打开模块级别的build.gradle文件。
  2. Delete the line for the applicationId . 删除applicationId的行。 Only an Android app module can define this. 仅Android应用程序模块可以定义它。
  3. At the top of the file, you should see the following: 在文件的顶部,您应该看到以下内容:

    apply plugin: 'com.android.application'

    Change it to the following: 将其更改为以下内容:

    apply plugin: 'com.android.library'

  4. Save the file and click File > Sync Project with Gradle Files. 保存文件,然后单击文件>与Gradle文件同步项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将项目包含在另一个项目中 - Including project within another project 是否在Android项目中包含JAR会影响apk的大小 - Does including JAR in android project affects the size of apk 导出APK库项目,并在另一个Android项目中使用它 - Export an APK library project, and use it in another Android project 在APK中包含资源文件夹 - Including resources folder in apk 将外部资产包括到APK中 - Including External Assets to the APK 在Android应用程序中包含大型Android Library Project(导致APK大小)? - Including large Android Library Project inside an Android app (resulting APK size)? 包括一些库项目后,通过命令行构建android项目的apk失败 - building apk of an android project via command line fails after including some library projects 如何在我的应用中运行Unity生成的apk,而又不将其作为模块包含在项目中? - How can I run Unity generated apk in my app without including it in the project as a module? 在Android项目中包含Joda Time和Common IO库时,在APK中复制的重复文件 - Duplicated files copied in APK when including both Joda Time and Common IO libraries in Android project 通过将其他项目的代码包含在我的构建路径中来尝试使用它 - Trying to use code from another project by including it in my build path
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM