[英]“Could not get unknown property 'mergeResourcesProvider' for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl.”
[英]Could not get unknown propert for object of type gradle build android studio
在我的 android 工作室項目中,我的 gradle.build 文件看起來一模一樣
buildscript {
ext.kotlin_version = "1.3.72"
repositories {
google()
jcenter()
maven {
url "https://maven.mozilla.org/maven2/"
}
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"
}
}
ext {
geckoviewChannel = "nightly"
geckoviewVersion = "85.0.20201121092754"
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
但是在運行./gradlew
出現錯誤,看起來像
A problem occurred evaluating root project 'My Application'.
> Could not get unknown property 'geckoviewChannel' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
我在這里沒有發現任何遺漏或錯誤。 我在這里想念什么。
項目屬性
ext {
geckoviewChannel = "nightly"
geckoviewVersion = "85.0.20201121092754"
}
在首先評估的 buildscript 塊中不可見。 一個潛在的解決方案是將 ext 塊移動到 buildscript 塊中。
這是另一個簡單的錯誤,我通過在module_name/build.gradle
中練習個人依賴來解決, 正如這里提到的。 我愚蠢地錯誤地忽略了項目根目錄的 build.gradle 文件中的注釋,上面寫着
dependencies {
...
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
所以我所做的是重置 build.gradle 並在 module_name/build.gradle 中配置 geckoview。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.