gpt4 book ai didi

gradle - flutter webview_flutter插件由于gradle问题而无法工作?

转载 作者:行者123 更新时间:2023-12-03 04:16:40 25 4
gpt4 key购买 nike

将flutter webview插件添加到flutter项目时出现gradle错误

嗨,我正在开发带有Flutter的应用程序,在我添加之前,它一直有效
flutter webview插件,然后出现此错误:

* Error running Gradle:
ProcessException: Process "C:\Users\p.mikaeil\Desktop\Files\Flutter Project\newapp\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:4.10.2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.10.2/gradle-4.10.2.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.10.2/gradle-4.10.2.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.10.2/gradle-4.10.2.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.10.2/gradle-4.10.2.jar
Required by:

我尝试更改android文件夹中的gradle版本,但没有解决问题。

我该如何解决这个问题?
感谢任何建议。

最佳答案

经过大量搜索和测试后,我找到了问题的解决方案:

问题是因为我的存储库不起作用。

解决问题之前,我的Project Build.gradle是这样的:

buildscript {
repositories {
google()
jcenter()

}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}

allprojects {
repositories {
google()
jcenter()

}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
}

解决问题后,Project Build.gradle应该是这样的:
buildscript {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
maven {
url 'https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api'
}
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}

allprojects {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
maven {
url 'https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api'
}
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
}

我也将android app build.gradle中的Compile Sdk Version和Target Sdk Version更改为28。

并且您还应该检查插件版本与android x的兼容性。

感谢这个伟大的社区。

关于gradle - flutter webview_flutter插件由于gradle问题而无法工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54593331/

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