Android的工作室:如何添加使用相对路径的一个项目? [英] Android Studio: How to add a project using relative path?

查看:359
本文介绍了Android的工作室:如何添加使用相对路径的一个项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要迁移到Android工作室,而不是Eclipse来我们的我们的应用程序的Andr​​oid版本。我尝试了很多东西,但我不能真正添加​​项目引用到我的Andr​​oid Studio项目。

I want to migrate to Android Studio instead of Eclipse to work on our Android version of our Application. I tried a lot of stuff but i cannot actually add a project reference into my Android Studio Project.

详细内容:

我有包括论文的文件夹一个Mercurial库:

I have a mercurial repository consisting of theses folders:



  • 根/ PROJECTA

  • 根/项目B

请注意,实际上,在Eclipse中,项目B是PROJECTA的项目引用。然后,当我编译,该项目B编译和PROJECTA后。如果我在任何论文的项目做出改变,我的源代码控制跟踪所有更改。

Note that actually, in eclipse, projectB is a project reference of PROJECTA. Then, when i compile, the PROJECTB is compiled and after the PROJECTA. If i made change in any of theses projects, my source control track all the changes.

当迁移到Android的工作室,项目B成为一个PROJECTA子文件夹。
所以我删除该项目B,并尝试将它作为以PROJECTA参考,但它只是不工作。我所做的唯一方式,它的工作原理是让项目B是PROJECTA下的子文件夹。

When migrating to Android Studio, PROJECTB becomes a subfolder in PROJECTA. So i delete the PROJECTB and try to include it as a reference to PROJECTA but it just does not work. The only way i made it works is to have the PROJECTB being a subfolder under PROJECTA.

但是,这不是一个解决方案,因为我们有20个项目,使用项目B的依赖关系,我必须能够将其添加到每个项目作为参考。

But this isn't a solution because we have 20 projects that uses PROJECTB as dependancy and I must be able to add it in each project as a reference.

有没有人有一个解决方案,阻断行为?

Does anyone has a solution to that blocking behaviour?

还有就是我已经试过的解决方案尚未:

1的gradle使用的文件与许多不同的参数:

1- Using gradle files with many different parameters:

包括':项目B'
项目(':项目B).projectDir =新的文件(settingsDir,'../项目B)

include ':PROJECTB' project(':PROJECTB).projectDir = new File(settingsDir, '../PROJECTB)

2 - 使用许多Android Studio的输入情况

2- Using many Android Studio importations

3祈求上帝帮助我。

现在我要问你们!

推荐答案

要在 PROJECTA 你必须使用项目B 做到以下几点:

To use PROJECTB in PROJECTA you have to do following:

修改你的 PROJECTA settings.gradle 包括项目B 并定义项目B 路径

Modify your PROJECTA settings.gradle to include PROJECTB and define PROJECTB path

include ':app', ':PROJECTB'
project(':PROJECTB').projectDir = new File(settingsDir, '../PROJECTB')

然后添加项目B 作为依赖于你的 PROJECTA 的build.gradle

dependencies {
    ...
    compile project(':PROJECTB')
}

这篇关于Android的工作室:如何添加使用相对路径的一个项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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