gpt4 book ai didi

android - PluginApplicationException : Failed to apply plugin class 'FlutterPlugin'

转载 作者:行者123 更新时间:2023-12-04 23:53:00 26 4
gpt4 key购买 nike

我有奇怪的错误,
在我升级 Android Studio 之后:
enter image description here
我创建了一个Android项目,运行成功。
然后我尝试导入Flutter Module到这个 Android 项目。
我有这些异常(exception),

Blockquote

Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin class 'FlutterPlugin'.


Caused by: org.Gradle.API.InvalidUserCodeException: Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by plugin class 'FlutterPlugin'


我搜索但没有找到该异常的解决方案,甚至 Clean project , Gradle clean build , 和 Restart & Invalidate Project .
请帮我解决这个问题,
谢谢,
p/s:在之前的 Android Studio 版本中,我是正常操作的。 (很简单)
导入flutter模块前运行android项目成功
enter image description here
项目结构
Project structure
settings.Gradle导入 Flutter Module 后
enter image description here
当前版本
enter image description here
Gradle clean build命令行
enter image description here

最佳答案

Android Studio 北极狐 | 2020.3.1 Patch 2 和 Flutter 2.2.3 有同样的问题,请按照以下步骤修复。
1.打开android项目settings.gradle,更改 FAIL_ON_PROJECT_REPOS PREFER_PROJECT

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
  • 打开 android 项目 build.gradle 添加这些配置
    所有项目{
    存储库{
    谷歌()
    中心()
    }
    }
  • 重建项目

  • https://docs.gradle.org/current/javadoc/org/gradle/api/initialization/resolve/RepositoriesMode.html

    关于android - PluginApplicationException : Failed to apply plugin class 'FlutterPlugin' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68571973/

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