Android的工作室增加外部项目build.gradle [英] Android studio add external project to build.gradle

查看:153
本文介绍了Android的工作室增加外部项目build.gradle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个示例项目,具有以下设置:

I have a sample project, with the following setup:

/root
  + Pure Java Lib
  + Android Test Lib
  + Android Test Project

凡'的测试项目的依赖于测试库的,最后取决于'的纯Java库的' 编译项目并启动此安装程序工作得很好。

Where the 'Test Project' is dependent on the 'Test Lib', and the last depends on the 'Pure Java Lib' Compiling the project and launching this setup works just fine.

我现在想引进我的previous Eclipse工作区,并与Android的工作室工作,问题是该项目的设置是不同的,我想保持这种方式。

I'm now thinking about importing my previous Eclipse workspace and work with Android studio, the problem is the project setup is different, and I would like to keep it this way.

例如,如果要使用previous例如:

for example if to use the previous example:

/root
  + Android Test Lib
  + Android Test Project

/Some Other folder (another repository for example)
  + Pure Java Lib

我试过很多配置,但我没有找到一个方法来引用项目的父文件​​夹的范围之内(的'在这个例子的情况下)。

I've tried many configurations, but I didn't find a way to reference a project outside the scope of the parent folder ('root' in the example case).

在很多平台/模块,你可以用'..'在文件夹上移,但是这并没有为我工作,也许我用错了。

In many platforms/modules you can use the '..' to move up in the folders but this didn't work for me, perhaps I've used it wrong.

有谁知道这是如何能与摇篮实现?

Does anyone know how this can be achieved with Gradle?

更新

我会尝试更通用的:

/C:/

  /Project A
    + Module 1 - Pure Java
    + Module 2 - Android Test Lib
    + Module 3 - Android Test Project

  /Project B
    + Module 1 - Pure Java
    + Module 2 - Pure Java
    + Module 3 - Pure Java

我想用为项目B 项目A

推荐答案

假定其他文件夹是一个摇篮的项目,您可以添加类似下面的内容你settings.gradle文件:

Assuming that Some Other Folder is a gradle project you could add something like the following to your settings.gradle file:

include ':module1'
project(':module1').projectDir = new File(settingsDir, '../Project B/Module 1')

这篇关于Android的工作室增加外部项目build.gradle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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