解決方法主要有兩種沧烈,一種是升級(jí)Android Studio到雪狐版本暗赶,然后安裝Java 11彤避,對(duì)就是要Java11才支持扰魂。
另一種是把項(xiàng)目Gradle Version調(diào)低麦乞,比如:Gradle Version:6.5、Gradle Plugin version:4.1.1
然后編譯會(huì)報(bào)以下錯(cuò)誤:
A problem occurred evaluating settings 'PackerQuickDevelop'.
> Could not find method dependencyResolutionManagement() for arguments [settings_3j3hkhbl8g4ki6b0h7rhxmftv$_run_closure1@10e89934] on settings 'PackerQuickDevelop' of type org.gradle.initialization.DefaultSettings.
這個(gè)時(shí)候需要在settings.gradle把以下內(nèi)容注釋:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
再編譯再報(bào)錯(cuò)劝评,
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Cannot resolve external dependency org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21 because no repositories are defined.
然后姐直,再項(xiàng)目模塊外的build.gradle,添加以下內(nèi)容:
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
//注意付翁,allprojects和buildscript是同級(jí)的
再編譯就通過(guò)啦简肴!