我决定下载android studio,因为它的外观和普及程度都很好。我遇到的第一个问题是添加外部库。大多数教程适用于旧版本。我做的事情:
创建'图书馆'目录并将THIS库放在里面
在settings.gradle内添加了
include ':app:libraries:drawer'
下的compile project(':app:libraries:drawer')
dependencies
按"同步项目与gradle文件"我得到了:
Gradle 'SCR' project refresh failed:
Cause: cannot get property 'compileSdkVersion' on extra properties extension as it does not exist
Pastebin sourcefiles:
项目中的settings.gradle:http://pastebin.com/NvuPG1St
项目内的build.gradle:http://pastebin.com/AT0Kjj8F
在src:http://pastebin.com/HjTKUazU 中的build.gradle
我该怎么办?
答案 0 :(得分:0)
使用此结构:
root
app
build.gradle
libraries
drawer
build.gradle
build.gradle
settings.gradle
使用
更改settings.gradle
include ':app'
include ':libraries:drawer'
更改app / build.gradle中的依赖关系
compile project(':libraries:drawer')
在抽屉内的build.gradle中,你必须在android块中指定你的源码。
android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['aidl']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
更新(在您的图片之后):
在您正在使用的drawer/build.gradle
中:
compileSdkVersion parent.ext.compileSdkVersion
buildToolsVersion parent.ext.buildToolsVersion
您应该在root/build.gradle
ext {
compileSdkVersion = 19
buildToolsVersion = "19.0.3"
}
并更改drawer/build.gradle
in:
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
答案 1 :(得分:0)
Controlling Android properties of all your modules from the main project
// SDK Version and Build Tools used by all subprojects
ext {
compileSdkVersion = 21
buildToolsVersion = '21.1.2'
}