所以我在 Gradle 檔案中實作了一些依賴項,當我嘗試同步它時,我得到
Build file '/home/qwirrr/AndroidStudioProjects/ClockIn/build.gradle' line: 9
A problem occurred evaluating root project 'ClockIn'.
> Could not find method implementation() for arguments [androidx.fragment:fragment:1.3.6] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Gradle 檔案如下所示:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
implementation 'androidx.fragment:fragment:1.3.6'
implementation 'com.google.android.material:material:1.0.0'
classpath "com.android.tools.build:gradle:7.0.3"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我試圖改變implementation到compile,甚至改變在classpath線的搖籃版本,但沒有成功。
我該如何解決?
注意:我正在使用 Pop_OS!20.04 LTS 如果這很重要
uj5u.com熱心網友回復:
你的依賴項應該進入build.gradle你的模塊/應用程式而不是build.gradle你的專案:
將build.gradle您的應用程式應該看起來是這樣的:
plugins {
id 'com.android.application'
...
}
android {
...
}
dependencies {
//all your dependencies goes here
implementation 'androidx.fragment:fragment:1.3.6'
implementation 'com.google.android.material:material:1.0.0'
}
唯一應該進入build.gradle您的專案的是類路徑。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/355080.html
