Flutter - FAILURE: Build failed with an exception. - Unable to start the daemon process. - Android Studio - VSCode
Solution 1
The problem was that OpenJDK platform binary opens many instances which eats up my memory, I found out about this problem from this question and this answer said to turn off the Hotspot and that did work. Also restarting your laptop might work for some cases but not all.
I don't know how the Hotspot is the problem or in what way is it connected to OpenJDK if anyone has an explanation please comment it.
Solution 2
Please always post your error logs as text and not images.
1- run flutter clean
then build again.
2- Are you running it on a simulator or physical device?
3- If on a simulator, increase that devices virtual ram. Better more, delete the simulator and create a new one.
4- If still doesn't work, run flutter upgrade
.
5- Can you build the file as an APK? in other words, not to run on a device?
6- Please post the output of flutter build apk -v
.
salma.m
Updated on December 28, 2022Comments
-
salma.m over 1 year
Whenever I try to run a flutter app using flutter run -v i get the below error. If i don't use the terminal and just click run the running gradle task keeps running and nothing happens.
I tried:
- changed in gradle.properties
org.gradle.jvmargs=-Xmx1536m => org.gradle.jvmargs:-Xmx1024m
- deleted .gradle file
- reset my laptop
what can i do?
*flutter build apk -v
[ +95 ms] executing: [C:\Flutter\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H [ +73 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H [ ] 4d7946a68d26794349189cf21b3f68cc6fe61dcb [ +1 ms] executing: [C:\Flutter\flutter/] git tag --points-at 4d7946a68d26794349189cf21b3f68cc6fe61dcb [ +93 ms] Exit code 0 from: git tag --points-at 4d7946a68d26794349189cf21b3f68cc6fe61dcb [ ] 2.0.3 [ +45 ms] executing: [C:\Flutter\flutter/] git rev-parse --abbrev-ref --symbolic @{u} [ +32 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u} [ ] origin/stable [ ] executing: [C:\Flutter\flutter/] git ls-remote --get-url origin [ +30 ms] Exit code 0 from: git ls-remote --get-url origin [ ] https://github.com/flutter/flutter.git [ +82 ms] executing: [C:\Flutter\flutter/] git rev-parse --abbrev-ref HEAD [ +27 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ ] stable [ +85 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +59 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update. [ +1 ms] Artifact Instance of 'GradleWrapper' is not required, skipping update. [ +4 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ ] Artifact Instance of 'FlutterSdk' is not required, skipping update. [ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'PubDependencies' is not required, skipping update. [ +48 ms] Skipping pub get: version match. [ +133 ms] Generating C:\Users\Salma\Desktop\Grad\flutter_app\android\app\src\main\java\io\flutter\plugins\GeneratedPlugin Registrant.java [ +396 ms] Building without sound null safety [ +1 ms] For more information see https://dart.dev/null-safety/unsound-null-safety [ +25 ms] Running Gradle task 'assembleRelease'... [ +8 ms] Using gradle from C:\Users\Salma\Desktop\Grad\flutter_app\android\gradlew.bat. [ +5 ms] C:\Users\Salma\Desktop\Grad\flutter_app\android\gradlew.bat mode: 33279 rwxrwxrwx. [ +10 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version [ +187 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version [ +2 ms] openjdk version "1.8.0_242-release" OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) OpenJDK 64-Bit Server VM (build 25.242-b01, mixed mode) [ +3 ms] executing: [C:\Users\Salma\Desktop\Grad\flutter_app\android/] C:\Users\Salma\Desktop\Grad\flutter_app\android\gradlew.bat -Pverbose=true -Ptarget-platform=android-arm,android-arm64,android-x64 -Ptarget=lib\main.dart -Ptrack-widget-creation=true -Ptree-shake-icons=true assembleRelease [+2795 ms] Starting a Gradle Daemon, 100 busy Daemons could not be reused, use --status for details [+2481 ms] Starting a Gradle Daemon, 101 busy Daemons could not be reused, use --status for details [+2502 ms] Starting a Gradle Daemon, 102 busy Daemons could not be reused, use --status for details [ +23 ms] FAILURE: Build failed with an exception. [ +4 ms] * What went wrong: [ +2 ms] Unable to start the daemon process. [ +1 ms] This problem might be caused by incorrect configuration of the daemon. [ +1 ms] For example, an unrecognized jvm option is used. [ +1 ms] Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.7/userguide/gradle_daemon.html [ +1 ms] Process command line: C:\Program Files\Android\Android Studio\jre\bin\java.exe -Xmx1024m -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant -cp C:\Users\Salma\.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 [ +1 ms] Please read the following process output to find out more: [ +1 ms] ----------------------- [ ] Error occurred during initialization of VM [ ] Could not reserve enough space for object heap [ ] * 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. [ +1 ms] * Get more help at https://help.gradle.org [ +30 ms] Running Gradle task 'assembleRelease'... (completed in 8.1s) [ +8 ms] "flutter apk" took 8,820ms. [ +8 ms] Gradle task assembleRelease failed with exit code 1 [ +3 ms] #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 buildGradleApp (package:flutter_tools/src/android/gradle.dart:411:7) <asynchronous suspension> #2 _AndroidBuilderImpl.buildApk (package:flutter_tools/src/android/android_builder.dart:101:7) <asynchronous suspension> #3 BuildApkCommand.runCommand (package:flutter_tools/src/commands/build_apk.dart:103:5) <asynchronous suspension> #4 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1157:12) <asynchronous suspension> #5 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1009:27) <asynchronous suspension> #6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19) <asynchronous suspension> #7 AppContext.run (package:flutter_tools/src/base/context.dart:149:12) <asynchronous suspension> #8 CommandRunner.runCommand (package:args/command_runner.dart:197:13) <asynchronous suspension> #9 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:278:9) <asynchronous suspension> #10 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19) <asynchronous suspension> #11 AppContext.run (package:flutter_tools/src/base/context.dart:149:12) <asynchronous suspension> #12 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:234:5) <asynchronous suspension> #13 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9) <asynchronous suspension> #14 run.<anonymous closure> (package:flutter_tools/runner.dart:62:12) <asynchronous suspension> #15 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19) <asynchronous suspension> #16 AppContext.run (package:flutter_tools/src/base/context.dart:149:12) <asynchronous suspension> #17 runInContext (package:flutter_tools/src/context_runner.dart:73:10) <asynchronous suspension> #18 main (package:flutter_tools/executable.dart:90:3) <asynchronous suspension> [ +117 ms] ensureAnalyticsSent: 113ms [ +4 ms] Running shutdown hooks [ +1 ms] Shutdown hooks complete [ +1 ms] exiting with code 1
-
CoderUni about 3 yearsYou don't have enough computer ram. I'd suggest switching to vscode and also upgrading your ram to at least 8gb
-
salma.m about 3 years@Uni, my ram 8gb (7.71 gb usable), for vscode it give an alert this window is no longer responding for flutter run
-
CoderUni about 3 yearsThat's weird. Could you post the output of flutter run --verbose?
- changed in gradle.properties
-
salma.m about 3 yearsI am running it on a physical device
-
Huthaifa Muayyad about 3 yearsIt could mean your device is out of memeory. Kindly post the output of
flutter build apk -v
, and we can see if your app builds or not, ro rule out it's an issue with your computer or configuration Vs simulator\phone issues. -
salma.m about 3 yearsI added
flutter build apk -v
output -
Huthaifa Muayyad about 3 years@salma.m it's apparently a computer issue, something is eating up your memory. Try restarting your computer freshly, close everything out and open open your code, then try to build it. What operating system are you using?
-
salma.m about 3 yearsI am using windows 10.
-
Huthaifa Muayyad about 3 yearsDid a fresh restart of your device help?
-
salma.m about 3 yearsYes the error is no longer there but it still gets stuck at running gradle task 'assembleDebug'
-
Huthaifa Muayyad about 3 years@salma.m this means progress.is the output of
flutter build apk -v
the same? How long have you been building? -
salma.m about 3 yearsFlutter build apk -v :
Unable to allocate 49152KB bitmaps for parallel garbage collection for the requested 1572864KB heap
-
salma.m about 3 yearsFlutter doctor -v: [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\Salma\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java X Could not determine java version
-
Amisha Kirti about 2 yearsYes! It worked for me too...