[英]Cannot run flutter application on first run, gradle error
I have created a new flutter app and I cannot get it to run for the first time.我创建了一个新的 flutter 应用程序,但我无法让它第一次运行。 It gets stuck at running Gradle task assembleDebug.
它在运行 Gradle 任务 assembleDebug 时卡住了。 This is the error message I get
这是我收到的错误消息
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> NDK at C:\Users\Hp\AppData\Local\Android\sdk\ndk-bundle did not have a source.properties file
* 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 3m 10s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I have ran flutter doctor and this are the results我跑过 flutter 医生,这就是结果
[√] Flutter (Channel stable, 2.0.0, on Microsoft Windows [Version 10.0.19041.804], locale en-US)
• Flutter version 2.0.0 at C:\dev\flutter
• Framework revision 60bd88df91 (2 days ago), 2021-03-03 09:13:17 -0800
• Engine revision 40441def69
• Dart version 2.12.0
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Hp\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.54.1)
• VS Code at C:\Users\Hp\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.20.0
[√] Connected device (3 available)
• Redmi 6 (mobile) • a28707477d26 • android-arm • Android 9 (API 28)
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.190
• Edge (web) • edge • web-javascript • Microsoft Edge 88.0.705.81
• No issues found!
For Android studio 4.1.1+ (gradle-plugin: 4.1.1 or above)
use ndkVersion对于 Android studio 4.1.1+
(gradle-plugin: 4.1.1 or above)
使用 ndkVersion
No ndk.dir at local.properties.
local.properties 中没有 ndk.dir。 If there is, remove it
如果有,删除它
build.gradle (module) build.gradle(模块)
android {
defaultConfig {
// ...
ndkVersion = "21.1.6352462"
}
}
Or In your Android Studio, Go to File -> Project Structure -> SDK Location -> Under "Android NDK Location"
, click on "Download" Android NDK Or In your Android Studio, Go to
File -> Project Structure -> SDK Location -> Under "Android NDK Location"
, click on "Download" Android NDK
Wait for download and re-build the project.等待下载并重新构建项目。 Cheers.
干杯。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.