I have created a new flutter app and I cannot get it to run for the first time. It gets stuck at running Gradle task 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 (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!
Base from the error, the NDK build in your machine can't be used. One way to resolve this issue is by deleting the current NDK and have Flutter download a new NDK build. Head over to the NDK path provided in the error and delete ndk-bundle folder, then run flutter clean in the terminal. Running the app again should automatically run flutter pub get to rebuild all the references and dependencies.
Related
Due to character limit, I posted the same problem in Github, Contains detailed operating information。https://github.com/flutter/flutter/issues/101572
Flutter suddenly runs errors, this is still normal a few days ago, I didn't make any changes during the period.
FAILURE: Build failed with an exception.
* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.7/userguide/gradle_daemon.html
Process command line: C:\sdk\android\Android Studio\jre\bin\java.exe --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -Xmx1536M -Dfile.encoding=GBK -Duser.country=CN -Duser.language=zh -Duser.variant -cp C:\Users\Venusؼ\.gradle\wrapper\dists\gradle-6.7-all\cuy9mc7upwgwgeb72wkcrupxe\gradle-6.7\lib\gradle-launcher-6.7.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.7
Please read the following process output to find out more:
-----------------------
����: �Ҳ��������������� org.gradle.launcher.daemon.bootstrap.GradleDaemon
ԭ��: java.lang.ClassNotFoundException: org.gradle.launcher.daemon.bootstrap.GradleDaemon
* 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
Running Gradle task 'assembleRelease'... 3.4s
Gradle task assembleRelease failed with exit code 1
This is my device information:
Windows: 11 21H2 22000.556 (notebook)
Flutter: 2.10.3
flutter doctor -v
[√] Flutter (Channel stable, 2.10.3, on Microsoft Windows [Version 10.0.22000.556], locale zh-CN)
• Flutter version 2.10.3 at C:\sdk\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (5 weeks ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\sdk\android\sdk
• Platform android-31-2, build-tools 31.0.0
• Java binary at: C:\sdk\android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.1)
• Android Studio at C:\sdk\android\Android Studio
• 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 11.0.11+9-b60-7590822)
[√] Connected device (4 available)
• M2007J1SC (mobile) • 5147b914 • android-arm64 • Android 12 (API 31)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.556]
• Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.75
• Edge (web) • edge • web-javascript • Microsoft Edge 100.0.1185.29
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
I have tried some methods, for example:
'if u are using a laptop and using a mobile hotspot from your laptop turn it off and run the program i hope this will solve your problem it worked for me.'
delete 'org.gradle.jvmargs=-Xmx1536M' or changed to 'org.gradle.jvmargs=-Xmx1024m',and restart the project。
unfortunately, these are useless to me.
my solution:
change the gradle dir position for the project. (the default setting is user/username/.gradle )
it seems that the windows defender block the progress.
Flutter project stopped building today all of a sudden.
Here's the full error:
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Could not resolve all dependencies for configuration ':app:debugCompileClasspath'.
> Problems reading data from Binary store in /private/var/folders/_5/q7ql37gj5k7f37d865zhzl8c0000gn/T/gradle18017070233811730283.bin offset 35036 exists? true
* 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 28s
Running Gradle task 'assembleDebug'... 29.7s
Exception: Gradle task assembleDebug failed with exit code 1
I have tried:
flutter clean, deleted pubspec.lock and flutter pub cache repair to get rid of cache and reinstall packages but nothing.
flutter downgrade, got the same error.
Fresh reinstall of flutter, same thing.
Fresh git clone of the project, nothing.
Any hints?
Here's my flutter doctor -v:
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-arm, locale
en-GB)
• Flutter version 2.8.1 at /Users/gracielacarrillo/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (4 weeks ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1
[✓] Android toolchain - develop for Android devices (Android SDK version
31.0.0)
• Android SDK at /Users/gracielacarrillo/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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 11.0.10+0-b96-7249189)
[✓] VS Code (version 1.63.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.32.0
[✓] Connected device (2 available)
• sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11
(API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google
Chrome 97.0.4692.71
• No issues found!
Maybe you are getting errors because of jcenter. Follow the link and switch to mavenCenteral.
Switch to Maven Central
i run the build in flutter, it will not proceed at this stage, below is the status of flutter doctor.
I don't know which part is wrong.
I get the following error, the installed package doesn't seem to match the version of flutter, but I don't know how to fix it.
Launching lib/main.dart on Android SDK built for arm64 in debug mode...
lib/main.dart:1
Note: /Users/madol.eeee/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.1/android/src/main/java/com/baseflow/geocoding/GeocodingPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Users/madol.eeee/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_android-2.0.0/android/src/main/java/com/baseflow/geolocator/location/LocationMapper.java:29: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
^
symbol: variable S
location: class VERSION_CODES
/Users/madol.eeee/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_android-2.0.0/android/src/main/java/com/baseflow/geolocator/location/LocationMapper.java:30: error: cannot find symbol
position.put("is_mocked", location.isMock());
^
symbol: method isMock()
location: variable location of type Location
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':geolocator_android:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 7s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.2, on macOS 11.6 20G165 darwin-arm, locale ko-KR)
• Flutter version 2.5.2 at /Users/madol.eeee/Downloads/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 3595343e20 (7 days ago), 2021-09-30 12:58:18 -0700
• Engine revision 6ac856380f
• Dart version 2.14.3
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/madol.eeee/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Users/madol.eeee/Downloads/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.0, Build version 13A233
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Users/madol.eeee/Downloads/Android Studio.app/Contents
• 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 11.0.10+0-b96-7249189)
[✓] VS Code (version 1.60.2)
• VS Code at /Users/madol.eeee/Downloads/Visual Studio Code.app/Contents
• Flutter extension version 3.27.0
[✓] Connected device (2 available)
• sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 94.0.4606.71
Open Android Studio--> Tools --> AVD Manager
wipedata of simulator
again run
Recently I immigrated my project to a new system and rectified all the errors but I got an exception that says provide flutter source directory.
I added the flutter SDK path and checked but I still couldn't solve the
problem.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutterSDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 572
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Could not create task ':app:compileFlutterBuildDebug'.
> Must provide Flutter source directory
* 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.
I have run the Flutter doctor cmd and everything is fine
flutter doctor -v
[√] Flutter (Channel stable, 2.5.0, on Microsoft Windows [Version 10.0.19043.1165], locale en-IN)
• Flutter version 2.5.0 at C:\src\flutterSDK\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cc385b4b8 (6 days ago), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\Barfi Nandeti\AppData\Local\Android\sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android Studio
• 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 11.0.10+0-b96-7249189)
[√] VS Code (version 1.60.0)
• VS Code at C:\Users\Barfi Nandeti\AppData\Local\Programs\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (2 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.63
• Edge (web) • edge • web-javascript • Microsoft Edge 93.0.961.47
• No issues found!
This is probably because the flutter SDK is in a different directory than your old machine. Checkout this answer.
After Flutter upgrade, I can't build app.
../../../flutter/.pub-cache/hosted/pub.dartlang.org/nfc_in_flutter-2.0.5/lib/src/api.dart:524:54: Error: The operator '[]' isn't defined for the class 'Object'.
'Object' is from 'dart:core'.
Try correcting the operator to an existing operator, or defining a '[]' operator.
throw NFCTagSizeTooSmallException(e.details["maxSize"] ?? 0);
^
FAILURE: Build failed with an exception.
Where:
Script '/Users/sissa/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '../../flutter/bin/flutter'' finished with non-zero exit value 1
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 41s
Exception: Gradle task assembleDebug failed with exit code 1
This is my Flutter doctor output:
[✓] Flutter (Channel master, 1.27.0-5.0.pre.18, on macOS 11.1 20C69 darwin-x64, locale en-GB)
• Flutter version 1.27.0-5.0.pre.18 at /Users/sissa/flutter
• Framework revision 50897c98fc (6 days ago), 2021-02-16 20:13:53 -0800
• Engine revision 9bcb3bfb0e
• Dart version 2.13.0 (build 2.13.0-30.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/sissa/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /Users/sissa/Library/Android/sdk
• Java binary at: /Applications/Android Studio 2.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• 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_202-release-1483-b49-5587405)
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio 2.app/Contents
• 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-b3-6915495)
[✓] VS Code (version 1.40.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• SM J610FN (mobile) • bbc7a841 • android-arm • Android 10 (API 29)
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.182
• No issues found!
Actions done that didn't work:
flutter clean
Invalidate caches / restart
Upgrading to 1.27.0-4.0.pre dev channel solve the problem. Thanks to #Akif suggestion.