在Android Studio中创建多个项目 [英] Create multiple projects in Android Studio

查看:632
本文介绍了在Android Studio中创建多个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要做什么:
在android studio中创建三个android项目
1)公共项目或图书馆项目(这是一个独立项目)
2)使用库项目的Project1
3)使用图书馆专案的Project2

What I want to do:
Create Three android project in android studio
1)Common Project or Library Project(This is a independent project)
2)Project1 which uses library project
3)Project2 which uses library project

出了什么问题?
在eclipse中很容易实现,但在android studio中则不行. 我无法在android studio中的单个窗口中打开三个项目.我尝试使用 modules 实现此功能,但它不符合我的要求,仅在现有项目中添加了一个模块,并存在循环依赖问题

What is the problem?
It is easily possible in eclipse but not in android studio. I can't open three project in single window in android studio.I tried to achieve this using modules but it does not fit my requirement,it just add an module in existing project and has a circular dependency problem.

我尝试了什么?
1) http://www .philosophicalhacker.com/2014/10/02/an-alternative-multiproject-setup-for-android-studio/ -这是一个漫长的手动过程,Android Studio不直接支持

What I tried?
1)http://www.philosophicalhacker.com/2014/10/02/an-alternative-multiproject-setup-for-android-studio/ -It is a lengthy manual process and Android Studio does not support it directly

2)模块 -在现有项目中添加模块 请帮助我.我在android studio中还很新.

2)Modules -It adds modules in existing project Please Help me.I am quite new in android studio.

推荐答案

Android Studio中的单个窗口中不能包含多个项目.但是您可以创建两个项目并共享公共库.

You can't have multiple projects in a single window in Android Studio. But you can create two projects and share the common library.

在项目的settings.gradle中添加

include ':commonLibrary'
project(':commonLibrary').projectDir= new File('../path_to_your_library_module')

build.gradle中添加compile project(':commonLibrary').

在两个项目中都执行此操作,并且公共库将作为模块添加到两个项目中.您在此库中所做的任何更改都会在两个窗口中反映出来

Do this in both projects and the common library will be added as module in both projects. Any changes you make in this library will reflect in both windows

这篇关于在Android Studio中创建多个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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