尽管已满足所有要求,但仍未找到 DSL 实现()
DSL implementation() not found despite all requirements fullfilled
我正在更新我的项目中的 Android Studio、Gradle 和 gradle 插件,因为我想实施 MoPub。
MoPub 似乎只适用于 gradle 的新版本,所以我最终不得不从 2.3 升级到 3。4.x
我这样做了,我什至更新了 Android Studio,但是,当我同步项目时,仍然找不到 DSL implementation()。
我的build.gradle(项目):
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:3.2.0'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的build.gradle(应用程序):
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "..."
minSdkVersion 23
targetSdkVersion 26
versionCode ...
versionName "..."
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter() // includes the MoPub SDK and AVID library
maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implmementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-firestore:12.0.1'
testImplementation 'junit:junit:4.12'
implementation('com.mopub:mopub-sdk:+@aar') {
transitive = true
}
}
apply plugin: 'com.google.gms.google-services'
我在同步时收到以下消息:
ERROR: Gradle DSL method not found: 'implmementation()'
Possible causes:
The project '...' 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.4.1 and sync project
The project '...' 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
当我点击第一个提示升级插件时出现错误,可能是因为我已经在使用 3.4.1
当我点击第二个时 gradle-wrapper.properties
打开,但我使用 gradle-5.1.1-all.zip
,这是最新的,对吧?
当我单击最后一个提示时,会打开一个弹出窗口,其中提供了大量我可以在应用程序模块中实施的插件。
为什么 Gradle 找不到 implementation()
,即使我有所有需要的版本等等?我该怎么办?
您在build.gradle
中有一个错字,您需要更改以下内容:
implmementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
进入这个:
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
你有一个额外的m
。
ERROR: Gradle DSL method not found: 'implmementation()'
检查错误信息。有一个 错别字。
使用
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
而不是
implmementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
我正在更新我的项目中的 Android Studio、Gradle 和 gradle 插件,因为我想实施 MoPub。
MoPub 似乎只适用于 gradle 的新版本,所以我最终不得不从 2.3 升级到 3。4.x
我这样做了,我什至更新了 Android Studio,但是,当我同步项目时,仍然找不到 DSL implementation()。
我的build.gradle(项目):
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:3.2.0'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的build.gradle(应用程序):
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "..."
minSdkVersion 23
targetSdkVersion 26
versionCode ...
versionName "..."
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter() // includes the MoPub SDK and AVID library
maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implmementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-firestore:12.0.1'
testImplementation 'junit:junit:4.12'
implementation('com.mopub:mopub-sdk:+@aar') {
transitive = true
}
}
apply plugin: 'com.google.gms.google-services'
我在同步时收到以下消息:
ERROR: Gradle DSL method not found: 'implmementation()'
Possible causes:
The project '...' 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.4.1 and sync project
The project '...' 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
当我点击第一个提示升级插件时出现错误,可能是因为我已经在使用 3.4.1
当我点击第二个时 gradle-wrapper.properties
打开,但我使用 gradle-5.1.1-all.zip
,这是最新的,对吧?
当我单击最后一个提示时,会打开一个弹出窗口,其中提供了大量我可以在应用程序模块中实施的插件。
为什么 Gradle 找不到 implementation()
,即使我有所有需要的版本等等?我该怎么办?
您在build.gradle
中有一个错字,您需要更改以下内容:
implmementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
进入这个:
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
你有一个额外的m
。
ERROR: Gradle DSL method not found: 'implmementation()'
检查错误信息。有一个 错别字。
使用
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
而不是
implmementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'