【发布时间】:2020-03-11 22:06:53
【问题描述】:
我在 Linux 上使用来自稳定频道 v1.9.1+hotfix.6 的 Flutter)、Android SDK 版本 29.0.2 和 Android Studio 版本 3.5。在 Ubuntu 18.4 上。所有必要的 PATH 都已设置。
医生总结显示没有问题。
当我运行“flutter build”时出现错误:
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "/.../flutter/raw/android/gradlew" exited abnormally:
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to
/.../android-sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
BUILD FAILED
Total time: 7.627 secs
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.
java.lang.IllegalStateException: buildToolsVersion is not specified.
at com.google.common.base.Preconditions.checkState(Preconditions.java:173)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:558)
...
...
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
FAILURE: Build failed with an exception.
* Where:
Script '/.../flutter/packages/flutter_tools/gradle/flutter.gradle' line: 27
* What went wrong:
A problem occurred evaluating script.
> Could not find method google() for arguments [] on repository container.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Command: /... /flutter/raw/android/gradlew app:properties
Please review your Gradle project setup in the android/ folder.
如何解决问题?
【问题讨论】:
-
你会分享你的 build.gradle 吗?
标签: flutter