将gradle从3.2.1
更新为3.3.2
后出现问题,我尝试同步我的项目并收到以下错误消息:
Gradle DSL method not found: 'x()'
Possible causes:
The project 'Makadu_Android' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.3.2 and sync project
The project 'Makadu_Android' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin
但是它变得棘手,错误消息说我应该将gradle更新到3.3.2,但是我已经在使用此版本。
在这里,我将粘贴gradle文件:
buildscript {
ext.kotlin_version = '1.3.21'
ext.fabric_version = '1.25.4'
ext.google_services_version = '4.0.2'
ext.publisher = '1.2.2'
ext.realmVersion = '5.4.0'
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.gms:google-services:$google_services_version"
classpath "io.fabric.tools:gradle:$fabric_version"
classpath "com.github.triplet.gradle:play-publisher:$publisher"
classpath "io.realm:realm-gradle-plugin:$realmVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
rxandroid_version = '2.0.1'
anko_version = '0.10.8'
rxjava_version = '2.1.7'
support_version = "28.0.0"
constraint_layout_version = "1.1.0"
junit_version = "4.12"
runner_version = "1.0.1"
espresso_core_version = "3.0.1"
retrofit_version = "2.3.0"
okhttp_version = "3.9.1"
adapter_rxjava_version = "2.3.0"
gson_version = "2.8.2"
retrofit_gson_converter_version = "2.3.0"
play_services_auth_version = "11.8.0"
firebase_version = "11.8.0"
jodatime_version = "2.9.9"
linkedin_version = "1.1.4"
facebook_version = "[4,5)"
glide_version = "4.6.1"
exoplayer_version = "2.6.1"
circular_imageview_version = "2.2.0"
realm_adapters_version = "2.1.1"
search_view_version = "1.4.0"
}
现在进入我的graddle-wrapper属性文件。
#Thu Apr 11 12:06:29 BRT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip