Mar*_*uto 10 android gradle android-gradle-plugin
当我尝试使用gradle构建我的Android应用程序时,我收到一个奇怪的错误.
我尝试运行时收到此错误gradle build:
Could not find method buildToolsVersion() for arguments [23.0.2] on root project 'latest'.
Run Code Online (Sandbox Code Playgroud)
但是,我检查了我的android SDK文件夹,看看这个版本是否真的丢失了.换句话说,发布的结果ls $ANDROID_HOME/build-tools/是这样的:
19.1.0 20.0.0 21.1.2 22.0.1 23.0.1 23.0.2 23.0.3
Run Code Online (Sandbox Code Playgroud)
如你所见,23.0.2存在.什么似乎是问题?
这是我的根build.gradle文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
ext {
compileSdkVersion 23
buildToolsVersion '23.0.2'
}
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是build.gradle文件
apply plugin: 'com.android.application'
apply from: 'copyLibs.gradle'
apply plugin: 'eclipse'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.marco.myapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 35
versionName "1.2.0.15"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
// avoid Travis failures
lintOptions {
abortOnError false
}
}
dependencies {
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libraries:openpgp-api-lib')
compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r'
compile 'com.jcraft:jsch:0.1.52'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.jayway.android.robotium:robotium-solo:5.3.1'
compile 'com.melnykov:floatingactionbutton:1.2.0'
}
tasks.findAll {
it.name.startsWith 'assemble'
}.each {
it.dependsOn copyDependenciesIntoLibs
}
Run Code Online (Sandbox Code Playgroud)
小智 14
你之所以看到这个,是因为你在根项目中声明的变量缺少一个赋值.
ext {
compileSdkVersion 23
buildToolsVersion '23.0.2'
}
Run Code Online (Sandbox Code Playgroud)
应该:
ext {
compileSdkVersion = 23
buildToolsVersion = '23.0.2'
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3774 次 |
| 最近记录: |