我的Android项目是与QUOT;使用的是旧版本的Android摇篮插件&QUOT的; [英] My android project is "using an old version of the Android Gradle plug-in"
问题描述
我收到此错误
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文件并更改我这部分的依赖
So i did research and realized I had to go to my project build.gradle file and change this part of my dependencies
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
但我build.gradle文件,可是没有说。这是我build.gradle文件
but my build.gradle file doesnt have that. This is my build.gradle file
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')
}
}
我在想什么?
What am I missing?
编辑:
更新code
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
推荐答案
您缺少一个 buildscript {...}
包含块相关性{类路径...}
阻止你上面显示(也是一个库{...}
块)。这样的块必须是可用的,至少在根项目的生成脚本,或应用插件:机器人
将无法正常工作
You are missing a buildscript { ... }
block containing the dependencies { classpath ... }
block you showed above (and also a repositories { ... }
block). Such a block must be available at least in the root project's build script, or apply plugin: "android"
won't work.
这篇关于我的Android项目是与QUOT;使用的是旧版本的Android摇篮插件&QUOT的;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!