Reputation:
I'm using Flutter from stable channel, v1.9.1+hotfix.6, on Linux), Android SDK version 29.0.2 and Android Studio version 3.5. on ubuntu 18.4. All necessary PATHs are set.
The doctor summary shows no problems.
When I run "flutter build" I get the error:
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.
How can the problem be fixed?
Upvotes: 2
Views: 2758
Reputation: 359
Per https://github.com/flutter/flutter/issues/53657#issuecomment-795808016, the recommended solution is now to simply upgrade your gradle version to 4.1.2 or higher.
classpath 'com.android.tools.build:gradle:4.1.2'
Upvotes: 2
Reputation: 1009
It appears that NDK is not on your PATH or the project is looking in the wrong place. First verify you have NDK installed/.
If NDK is indeed installed you will need to change project structure to point to the correct location.
Upvotes: 1