1. Preface
I wrote an article about the first experience of flutter.
After a while, I changed my computer, re-installed androidstudio, and continued to build a flutter. Then I used the plug-in for a while to complete the configuration, then I created a project with the AS, good guy, and reported an error directly.
Launching lib\main.dart on ONEPLUS A5010 in debug mode...Initializing gradle...Resolving dependencies...* Error running Gradle:Exit code 1 from: F:\android_studio_workspace\flutter_app2\flutter_app2\android\gradlew.bat app:properties: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 E:\AndroidSDK\ndk-bundle.If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.FAILURE: Build failed with an exception.* Where:Build file ‘F:\android_studio_workspace\flutter_app2\flutter_app2\android\app\build.gradle‘ line: 25* What went wrong:A problem occurred evaluating project ‘:app‘.> Could not resolve all files for configuration ‘classpath‘.> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).Searched in the following locations:https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar* 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.orgBUILD FAILED in 2sFinished with error: Please review your Gradle project setup in the android/ folder.
2. Problem Analysis
First look at the last message:
finished with error: please review your gradle project setup in the android/ folder.
Said, let me check gradle and find out all sorts of information.
Let's start with the first error:
NDK is missing a "platforms" directory. If you are using NDK, verify the ndk_ ......
Good guy, what is this.
Ndk lacks a "platforms" directory. If you are using ndk, verify the ndk. Set dir to a valid ndk directory.
Currently, it is set to D: androidsdk \ ndk-bundle.
If ndk is not used, uninstall the ndk variable from android_ndk_home or local. Property to delete this warning.
2.1 solve the first problem
If it is less, install one.
Download link: https://developer.android.google.cn/ndk/downloads/
Download and decompress the ZIP file to get a folder named Android-ndk-rxxb. decompress the file directly and move all the files in the folder to your, SDK, and ndk-bundle folder.
Configure an environment variable and restart as to solve the problem.
2.2 solve the second problem
Build file ‘F:\android_studio_workspace\flutter_app2\flutter_app2\android\app\build.gradle‘ line: 25
Find the \ flutter \ packages \ flutter_tools \ gradle \ flutter. gradle file in the flutter SDK path.
Change the gradle version to a lower level.
Blog: https://www.cnblogs.com/niceyoo
2. Flutter trap filling record