I recently downloaded Android Studio Bumblebee and it helpfully asked whether I wanted to upgrade to Android Gradle Plugin 7.1.0, the version that shipped alongside Android Studio Bumblebee.
After upgrading, I get a build error:
Unable to load class 'com.android.build.api.extension.AndroidComponentsExtension'.
This is an unexpected error. Please file a bug containing the idea.log file.
Run Code Online (Sandbox Code Playgroud)
And looking at the idea.log file, I see:
A problem occurred evaluating project ':main'.
at org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:103)
...
Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':main'.
at …Run Code Online (Sandbox Code Playgroud) android android-gradle-plugin firebase-performance android-architecture-navigation android-safe-args
由于我将 Android Studio 更新为Bumblebee项目级别的 build.gradle 文件包含plugins以下块:
plugins {
id 'com.android.application' version '7.1.1' apply false
id 'com.android.library' version '7.1.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
此处,之前位于顶级 build.gradle 文件中的存储库设置现在位于 settings.gradle 文件中。
通过此更改,我无法向我的应用程序添加新插件,我想将以下插件添加到我已添加到应用程序级别的项目中build.gradle。
apply plugin: 'kotlin-android-extensions'
apply plugin: "androidx.navigation.safeargs.kotlin"
Run Code Online (Sandbox Code Playgroud)
为了完成这项工作,我需要在我的项目级别 build.gradle 中添加类路径,但是由于最近 build.gradle 结构的更改,我不确定如何在我的项目级别添加以下行build.gradle
dependencies {
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0"
}
Run Code Online (Sandbox Code Playgroud)
我试图在https://developer.android.com/studio/releases/gradle-plugin中找到解决方案,但是我看不到任何解决方案,但是我发现这个更改来自带有 gradle 插件的 Android Studio Bumblebee版本7.0.0
请帮我添加依赖项。