作者:手机用户2402852387 | 来源:互联网 | 2023-07-30 15:25
先贴配置,build.gradle
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
//mavenCentral()
// maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
// maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
// maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
// maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
mavenCentral()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
} |
运行flutter run之后,报错如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle... 0.9s
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "D:\flutterproject\tk\android\gradlew.bat" exited abnormally:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {}
error.
FAILURE: Build failed with an exception.
* Where:
Script 'D:\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 27
* What went wrong:
A problem occurred evaluating script.
> Could not find method maven() for arguments [flutter_70fv7lssvws82r3weljr8tpe1$_run_closure1$_closure4@6a83feb5] on object of
type org.gradle.api.internal.initialization.DefaultScriptHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan
to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Command: D:\flutterproject\tk\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder. |
请问有人遇到过吗?查好久没找到答案。希望有大神帮忙解决下,谢谢谢谢