Java 错误:(9,0):&x27;谷歌()';找不到Gradle DSL方法
嗨,在我解决了这个问题之后 建好后我收到了这个Java 错误:(9,0):&x27;谷歌()';找不到Gradle DSL方法,java,android,android-gradle-plugin,Java,Android,Android Gradle Plugin,嗨,在我解决了这个问题之后 建好后我收到了这个 Error:This Gradle plugin requires Studio 3.0 minimum 然后我将gradle-wrapper.properties更新为3.3 我收到这个 Error:(9, 0): 'google()' Gradle DSL method not found 这是我的构建梯度文件 //顶级生成文件,您可以在其中添加所有子项目/模块通用的配置选项 buildscript { repositories {
Error:This Gradle plugin requires Studio 3.0 minimum
然后我将gradle-wrapper.properties更新为3.3
我收到这个
Error:(9, 0): 'google()' Gradle DSL method not found
这是我的构建梯度文件
//顶级生成文件,您可以在其中添加所有子项目/模块通用的配置选项
buildscript {
repositories {
maven {
url 'https://maven.google.com'
}
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
/* CHANGE to classpath 'com.android.tools.build:gradle:2.3.3' for STABLE BUILD TOOL VERSION*/
// classpath 'com.android.tools.build:gradle:3.0.0-alpha7'
// classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.0.0-beta1'
classpath 'com.google.gms:google-services:3.1.0'
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url 'https://maven.google.com'
}
// google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是构建gradle模块应用程序
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven {
url 'https://maven.google.com'
}
// google()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion '26.0.0'
defaultConfig {
applicationId "in.techware.lataxi"
minSdkVersion 15
targetSdkVersion 25
versionCode 5
versionName "1.0.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
/* Remove This to remove Crashlytics and Fabric */
/* compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true;
}*/
/* compile('com.digits.sdk.android:digits:2.0.6@aar') {
transitive = true;
}*/
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:design:25.4.0'
implementation 'com.android.support:recyclerview-v7:25.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.android.support:cardview-v7:25.4.0'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.google.android.gms:play-services-maps:11.0.2'
implementation 'com.google.android.gms:play-services-location:11.0.2'
implementation 'com.google.android.gms:play-services-places:11.0.2'
implementation 'com.google.firebase:firebase-auth:11.0.2'
implementation 'com.google.firebase:firebase-messaging:11.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta1'
implementation 'com.google.code.gson:gson:2.8.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
google()
尝试在gradle wrapper.properties中使用
distributionUrl=\
https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip
在任何情况下,您都可以使用相同的maven repo,使用{url'https://maven.google.com“}
(相同)
再次执行后出错:此Gradle插件需要Studio 3.0 Minimuma您是否使用Android Studio 3.x?然后您必须使用maven{url'https://maven.fabric.io/public“}
而不是google()
。这是一样的。看看我的身材。格雷德尔我已经这么做了。。。但我得到了一个错误:这个Gradle插件至少需要Studio 3.0。我应该将我的android Studio更新为3吗?在发布的顶级文件中,在buildscript块中有google()repo。使用Android studio 2.3使用gradle插件2.3.3
buildscript {
repositories {
maven {
url 'https://maven.google.com'
}
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
//
}