我的android项目是;使用旧版本的Android Gradle插件;
我得到了这个错误我的android项目是;使用旧版本的Android Gradle插件;,android,gradle,Android,Gradle,我得到了这个错误 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. 所以我做了研究,并意识到我必须转到我的project buil
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.
所以我做了研究,并意识到我必须转到我的project 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插件:“安卓”
依赖关系{
编译文件树(目录:“libs”,包括:“*.jar”)
编译项目(“:桌面:编码:滑动菜单主菜单:库”)
}
安卓{
编译DK19版
buildToolsVersion“19.0.0”
源集{
主要{
manifest.src文件“AndroidManifest.xml”
java.srcDirs=['src']
resources.srcDirs=['src']
aidl.srcDirs=['src']
renderscript.srcDirs=['src']
res.srcDirs=['res']
assets.srcDirs=['assets']
}
//将测试移动到tests/java、tests/res等。。。
instrumentTest.setRoot('tests'))
//将生成类型移动到生成类型/
//例如,build-types/debug/java、build-types/debug/AndroidManifest.xml。。。
//这会将它们移出src/…下的默认位置,这将
//与主源集正在使用的src/冲突。
//应同时添加新的构建类型或产品风格
//通过类似的定制。
setRoot('build-types/debug')
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')
}
}
apply插件:“安卓”
构建脚本{
存储库{
mavenCentral()
}
依赖关系{
classpath'com.android.tools.build:gradle:0.6.4'
编译文件树(目录:“libs”,包括:“*.jar”)
编译项目(“:桌面:编码:滑动菜单主菜单:库”)
}
}
安卓{
编译DK19版
buildToolsVersion“19.0.0”
源集{
主要{
manifest.src文件“AndroidManifest.xml”
java.srcDirs=['src']
resources.srcDirs=['src']
aidl.srcDirs=['src']
renderscript.srcDirs=['src']
res.srcDirs=['res']
assets.srcDirs=['assets']
}
//将测试移动到tests/java、tests/res等。。。
instrumentTest.setRoot('tests'))
//将生成类型移动到生成类型/
//例如,build-types/debug/java、build-types/debug/AndroidManifest.xml。。。
//这会将它们移出src/…下的默认位置,这将
//与主源集正在使用的src/冲突。
//应同时添加新的构建类型或产品风格
//通过类似的定制。
setRoot('build-types/debug')
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
没有方法签名:org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile()适用于参数类型:(org.gradle.api.internal.file.collections.DefaultConfigurableFileTree)值:[目录'libs']
可能的解决方案:模块(java.lang.Object)
生成文件“C:\Users\cmtc\Documents\Android\StayHealthy\Build.gradle”行:10
您缺少一个
buildscript{…}
块,其中包含上面显示的依赖项{classpath…}
块(还有一个存储库{…}
块)。这样的块必须至少在根项目的构建脚本中可用,或者apply plugin:“android”
不起作用。如何获取这些,这个build.gradle文件是生成的。你能举个例子吗?看Gradle Android插件文档。我更新了我的代码,现在有了一整套新的问题。为什么eclipse不导出正确的.gradle文件?我不知道<代码>编译依赖项需要进入依赖项
块之外的构建脚本
。只有classpath
依赖项在buildscript
中。如果Eclipse中有多个模块,那么在项目结构的根目录下(在settings.gradle旁边)应该有一个build.gradle。该位置显示在导出向导中。这是build.gradle文件,其中包含需要更新的行。