我有这个摇篮错误。
错误:(9,0)没有找到摇篮DSL的方法:编译()
Error:(9, 0) Gradle DSL method not found: 'compile()'
我tryed类似的问题,但没有奏效。
I've tryed similar questions but it didn't work.
Android摇篮的生成错误:(9,0)没有找到摇篮DSL的方法:编译()'
Getting错误"未发现摇篮DSL的方法:编译()'"同步时Build.Gradle
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.+'
}