我收到此错误
Project is using an old version of the Android Gradle plug-in. The minimum supported version is 0.6.3.
Please update the version of the dependency 'com.android.tools.build:gradle' in your build.gradle files.
所以我做了研究并意识到我必须转到我的项目build.gradle文件并更改我的依赖项的这部分
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
但我的build.gradle文件没有。这是我的build.gradle文件
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':Desktop:Coding:SlidingMenu-master:library')
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
我错过了什么?
编辑:
更新代码
apply plugin: 'android'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.4'
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':Desktop:Coding:SlidingMenu-master:library')
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
新错误
No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (org.gradle.api.internal.file.collections.DefaultConfigurableFileTree) values: [directory 'libs']
Possible solutions: module(java.lang.Object)
<a href="error in file: C:\Users\cmtc\Documents\Android\StayHealthy\build.gradle at line: 10">Build file 'C:\Users\cmtc\Documents\Android\StayHealthy\build.gradle' line: 10
答案 0 :(得分:0)
您错过了一个buildscript { ... }
块,其中包含您在上面显示的dependencies { classpath ... }
块(以及repositories { ... }
块)。这样的块必须至少在根项目的构建脚本中可用,否则apply plugin: "android"
将不起作用。