如何将一个android工作室项目组合到另一个android工作室项目中 [英] How to combine one android studio project into another android studio project

查看:107
本文介绍了如何将一个android工作室项目组合到另一个android工作室项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个独立的Android应用程序项目是在android工作室制作的我试图将项目1组合到项目2中,使其成为一个应用程序我将如何去做这个?我知道如何在eclipse中这样做,但不是在android studio中。
请注意他们这些项目都是android应用程序,它们都不是android库。

I have two separate android app projects that were made in android studio I am trying to combine project 1 into project 2 to make it all one app how would I go about doing this? I know how to do it in eclipse but not in android studio. Please note they are both of these projects are android applications none of them are android libraries.

任何帮助都会很棒!

当我将项目1导入项目模块时,我在成绩上遇到此错误构建:

When I import project 1 into project module I get this error on grade build:


警告:依赖性学校工具Calc lib.gz:SchoolTools:项目应用程序未指定解析为不支持的APK存档编译依赖。文件:/ Users / chrisdebrodie / Documents / School Tools Calc lib.gz / SchoolTools / build / outputs / apk / SchoolTools-release-unsigned.apk

Warning:Dependency School Tools Calc lib.gz:SchoolTools:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: /Users/chrisdebrodie/Documents/School Tools Calc lib.gz/SchoolTools/build/outputs/apk/SchoolTools-release-unsigned.apk


推荐答案

您不能在Android Studio中将两个项目作为单个项目。

You cannot have two "projects" as a single project in Android Studio.

转换一个(或两个)项目进入图书馆。然后创建一个shell项目来构建每个应用程序。 shell项目基本上是空的,或者它可能具有特定的值覆盖。这里的优点是您可以修改库,更改将立即反映在两个/所有版本中。缺点是您必须修复因任何库更改而导致的所有项目中的任何问题。但是,您可以以类似的方式创建组合项目。

Convert one (or both) project into libraries. Then create a "shell" project to build each app. The shell project is basically empty, or it may have build specific value overrides. The advantage here is that you can modify the library and changes will be immediately reflected in both/all versions. The drawback is that you will have to fix any issues in all projects that result from any change to any library. But you can then create the "combined" project in a similar manner.

将一个或两个转换为库后,您可以创建一个 aar 文件。这使您可以选择将 aar 包含为gradle依赖项。请注意每次修改项目时都需要重新构建 aar - 所以如果你有一个关于哪个是更稳定的代码库的指示,那就去吧用于 aar 。这使您能够控制主项目依赖项,以便您可以对一个项目进行更改而不会影响另一个项目的稳定性。

After you convert one or both to a library you can create an aar file. This gives you the option to then include that aar as a gradle dependency. Be careful to remember that you will need to re-build the aar every time you modify that project - so if you have an indication as to which is the more stable codebase, go with that for the aar. This gives you the ability to "version control" the main project dependency so that you can make changes to one project without impacting the stability of the other.

此外,您还可以编写脚本并使用Bamboo或Jenkins等工具对 aar 进行实时更新 - 但这就像使用快照依赖项一样。当您更改 aar 时,它可能会编译,但在您对该项目进行构建之前,它可能会在您不知情的情况下中断第二个项目的构建。 (是的,您可以将该项目的构建作为Bamboo或Jenkins脚本的一部分包含在内,但这并不容易。)

Additionally, you can write scripts and use tools like Bamboo or Jenkins to do real-time updates to the aar - but that is like using a "snapshot" dependency. When you change the aar it may compile, but it may break the build of the second project without you knowing it until you do a build on that project. (And yes, you can include a build on that project as a part of the Bamboo or Jenkins script, but it isn't easy.)

可能还有其他选择,但这些似乎提供了足够的选项来产生各种各样的构建选项。

There may be other alternatives, but these seem to offer enough options to produce a wide variety of build options.

这篇关于如何将一个android工作室项目组合到另一个android工作室项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆