集成文档:官方入口
1、当我们按照官方集成好后,你会遇到第一个问题。
问题1:Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin class 'FlutterPlugin'.
解决方式:
settings.gradle 中
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
修改为:
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
2、当我们以为完事大吉的时候,运行时又报错了
问题2:各种库找不到,各种失败Fail
image.png
解决方式:
复制下面代码到项目project的build.gradle
allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
完整代码:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.0' apply false
id 'com.android.library' version '7.2.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
}
allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在运行试下,OK~
网友评论