androidstudio多个module放在一个目录下

来源:互联网 发布:淘宝数据魔方有用吗 编辑:程序博客网 时间:2024/05/17 08:31

以添加GifView为例

1、工程目录下新建librarys

2、把第三方工程拷贝进来。

3、修改工程目录下的settings.gradle,添加
include ‘:app’,’:librarys:GifView

4、修改app目录下的build.gradle
dependencies {
compile project(‘:librarys:GifView‘)
}

5、在librarys/GifView目录下添加build.gradle文件:
内容:
apply plugin: ‘com.android.library’
android {
compileSdkVersion 23
buildToolsVersion “23.0.2”

defaultConfig {    minSdkVersion 15    targetSdkVersion 23    versionCode 1    versionName "1.0"}buildTypes {    release {        minifyEnabled false        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'    }}

}

dependencies {
compile fileTree(dir: ‘libs’, include: [‘*.jar’])
testCompile ‘junit:junit:4.12’
compile ‘com.android.support:appcompat-v7:23.1.1’
}

6、检查Project Stucture下面的app里面是不是有
:librarys:GifView

如果没有成功,多半是加粗部分写错了,少了一个层级。

0 0
原创粉丝点击