(1) 项目根目录下settigs.gradle里添加第三方库名(例如:testlibrary)
:include ':app',':testlibrary'
(2) 在app下的build.gradle里dependencies节点下添加引用
AS 3.0之前:
...
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.0'
compile project(':library')//引用第三方项目
...
}
AS 3.0之后:
...
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:25.0.0'
implementation project(':library')//引用第三方项目
...
}
(3) 同步更新Gradle (Sync now)
1118

被折叠的 条评论
为什么被折叠?



