gpt4 book ai didi

android - 找不到参数[androidx.appcompat:appcompat:1.1.0-rc01]的方法Implementation()

转载 作者:行者123 更新时间:2023-12-03 03:38:22 27 4
gpt4 key购买 nike

我已经在多个地方看到了这个问题。问题似乎与过去的gradle版本3和android studio版本3的更新有关。每当我将依赖项更改为较新的版本时,我都会不断收到错误消息:

Could not find method implementation() for arguments [androidx.appcompat:appcompat:1.1.0-rc01] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

这是我的build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}

google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:3.5.0')

}
}

我的gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

感谢您的帮助。一直试图让我的应用在Android上运行一天。

最佳答案

在顶级文件的buildscript块中删除以下行:

//implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
//implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02

您必须在 dependencies文件的 module/build.gradle块中添加这些依赖项。

同时删除 dependencies块内的 allprojects
buildscript {
ext {
//...
}
repositories {
//..
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

allprojects {
repositories {
//..
google()
jcenter()
}
}

关于android - 找不到参数[androidx.appcompat:appcompat:1.1.0-rc01]的方法Implementation(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58379548/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com