Creating Modules without copying files
解决方案
The module needs to have a Gradle build file set up for it. If it’s got that, then in the project you’re linking to it, add this to the settings.gradle file at the project root
include ':libraryName'
project(':libraryName').projectDir=new File('/path/to/library')
例如要把外部工程 volley
引入
include ':volley'
project(':volley').projectDir=new File('../volley')
参考
应用某个模块 (例如上一步的 volley
)
修改要依赖 volley
的项目的 build.gradle
文件
修改 dependencies
为 (其中的 compile 和 androidTestCompile 为新增加的)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
androidTestCompile project(':volley')
compile project(':volley')
}
删除模块
解决方案
模块上 -> 右键 Open Module Settings -> 左侧选中相应模块 -> 点击左上角的 - 按钮
磁盘上删除此模块
参考
http://stackoverflow.com/questions/16710290/how-to-delete-a-module-in-android-studio