摇篮DSL方法未找到:“编译() [英] Gradle DSL method not found: 'compile()'
问题描述
我有这个摇篮错误。
错误:(9,0)没有找到摇篮DSL的方法:编译()
Error:(9, 0) Gradle DSL method not found: 'compile()'
我tryed类似的问题,但没有奏效。
I've tryed similar questions but it didn't work.
<一个href="http://stackoverflow.com/questions/26851230/android-gradle-build-error9-0-gradle-dsl-method-not-found-compile">Android摇篮的生成错误:(9,0)没有找到摇篮DSL的方法:编译()'
<一个href="http://stackoverflow.com/questions/27156428/getting-error-gradle-dsl-method-not-found-compile-when-syncing-build-grad">Getting错误&QUOT;未发现摇篮DSL的方法:编译()'&QUOT;同步时Build.Gradle
<一个href="http://stackoverflow.com/questions/24730117/unsupported-gradle-dsl-method-found-compile">Unsupported摇篮DSL方法发现:编译()'
我的 build.gradle
code是这里
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services:6.5.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
build.gradle(Module.app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.example.simplemaker.pushtest"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
什么是错我的code?
What's wrong my code?
对不起,我的英语水平。
Sorry for my English.
非常感谢!
推荐答案
随着项目的 build.gradle
文件的说明提出:
As the note of your project's build.gradle
file suggests:
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
在摇篮文件中删除2编译语句:
Remove the 2 compile statements in that gradle file:
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services:6.5.+'
然后进行其他(模块) build.gradle
相关性是这样的:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.+'
}
这篇关于摇篮DSL方法未找到:“编译()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!