Execution failed for task ':app:generateDebugBuildConfig'. in flutter

1,254

Solution 1

I resolved the whole problem, by deleting the folder "build" in the project file.

Solution 2

Run flutter clean and flutter pub get commands in your project folder

Share:
1,254
richardcode
Author by

richardcode

Updated on December 30, 2022

Comments

  • richardcode
    richardcode over 1 year

    THE ANSWER IS POSTED IN THE COMMENTS

    so I am getting this error when I try to run the flutter run

    Here is my flutter run -v

    [ +400 ms] executing: [C:\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
    [ +200 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
    [   +2 ms] 9b2d32b605630f28625709ebd9d78ab3016b2bf6
    [   +2 ms] executing: [C:\flutter/] git tag --points-at HEAD
    [ +189 ms] Exit code 0 from: git tag --points-at HEAD
    [        ] 1.22.6
    [  +11 ms] executing: [C:\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
    [  +59 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
    [   +1 ms] origin/stable
    [        ] executing: [C:\flutter/] git ls-remote --get-url origin
    [  +45 ms] Exit code 0 from: git ls-remote --get-url origin
    [        ] https://github.com/flutter/flutter.git
    [  +89 ms] executing: [C:\flutter/] git rev-parse --abbrev-ref HEAD
    [  +69 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
    [   +1 ms] stable
    [ +109 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
    [   +1 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.
    [   +8 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.
    [   +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
    [  +40 ms] executing: C:\Users\risha\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
    [  +79 ms] List of devices attached
               emulator-5554          device product:sdk_gphone_x86 model:sdk_gphone_x86 device:generic_x86_arm
               transport_id:1
    [  +15 ms] C:\Users\risha\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell getprop
    [  +68 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
    [   +8 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
    [   +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
    [   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
    [   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
    [   +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
    [   +1 ms] 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.
    [ +654 ms] Generating
    C:\Users\risha\development\flutter\willtenn\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
    [  +65 ms] ro.hardware = ranchu
    [  +40 ms] Using hardware rendering with device sdk gphone x86. If you notice graphics artifacts, consider enabling
    software
               rendering with "--enable-software-rendering".
    [  +57 ms] Starting incremental build...
    [  +11 ms] Initializing file store
    [  +37 ms] Skipping target: gen_localizations
    [  +30 ms] complete
    [  +14 ms] Launching lib\main.dart on sdk gphone x86 in debug mode...
    [  +22 ms] C:\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev
    C:\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root
    C:\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names
    --experimental-emit-debug-metadata -Ddart.developer.causal_async_stacks=true --output-dill
    C:\Users\risha\AppData\Local\Temp\flutter_tools.3ced7550\flutter_tool.c5ea3fda\app.dill --packages .packages
    -Ddart.vm.profile=false -Ddart.vm.product=false
    --bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoi
    d-closure-call-instructions --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root
    --initialize-from-dill build\cache.dill.track.dill
    [  +39 ms] executing: C:\Users\risha\AppData\Local\Android\sdk\build-tools\30.0.2\aapt dump xmltree
    C:\Users\risha\development\flutter\willtenn\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
    [  +68 ms] Exit code 0 from: C:\Users\risha\AppData\Local\Android\sdk\build-tools\30.0.2\aapt dump xmltree
    C:\Users\risha\development\flutter\willtenn\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
    [   +5 ms] N: android=http://schemas.android.com/apk/res/android
                 E: manifest (line=2)
                   A: android:versionCode(0x0101021b)=(type 0x10)0x1
                   A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
                   A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1d
                   A: android:compileSdkVersionCodename(0x01010573)="10" (Raw: "10")
                   A: package="com.example.willtenn" (Raw: "com.example.willtenn")
                   A: platformBuildVersionCode=(type 0x10)0x1d
                   A: platformBuildVersionName=(type 0x10)0xa
                   E: uses-sdk (line=7)
                     A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
                     A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1d
                   E: uses-permission (line=14)
                     A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
                   E: application (line=22)
                     A: android:label(0x01010001)="willtenn" (Raw: "willtenn")
                     A: android:icon(0x01010002)=@0x7f080000
                     A: android:name(0x01010003)="io.flutter.app.FlutterApplication" (Raw:
                     "io.flutter.app.FlutterApplication")
                     A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                     A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw:
                     "androidx.core.app.CoreComponentFactory")
                     E: activity (line=28)
                       A: android:theme(0x01010000)=@0x7f0a0000
                       A: android:name(0x01010003)="com.example.willtenn.MainActivity" (Raw:
                       "com.example.willtenn.MainActivity")
                       A: android:launchMode(0x0101001d)=(type 0x10)0x1
                       A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                       A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                       A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                       E: meta-data (line=42)
                         A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw:
                         "io.flutter.embedding.android.NormalTheme")
                         A: android:resource(0x01010025)=@0x7f0a0001
                       E: meta-data (line=52)
                         A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw:
                         "io.flutter.embedding.android.SplashScreenDrawable")
                         A: android:resource(0x01010025)=@0x7f040000
                       E: intent-filter (line=56)
                         E: action (line=57)
                           A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                         E: category (line=59)
                           A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw:
                           "android.intent.category.LAUNCHER")
                     E: meta-data (line=66)
                       A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                       A: android:value(0x01010024)=(type 0x10)0x2
    [  +32 ms] executing: C:\Users\risha\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell -x logcat
    -v time -t 1
    [ +121 ms] Exit code 0 from: C:\Users\risha\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell -x
    logcat -v time -t 1
    [   +4 ms] --------- beginning of main
               06-29 22:35:20.130 E/wifi_forwarder(  490): RemoteConnection failed to initialize: RemoteConnection failed to
               open pipe
    [   +5 ms] executing: C:\Users\risha\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell -x logcat
    -v time -t 1
    [ +118 ms] Exit code 0 from: C:\Users\risha\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell -x
    logcat -v time -t 1
    [   +4 ms] --------- beginning of main
               06-29 22:35:20.130 E/wifi_forwarder(  490): RemoteConnection failed to initialize: RemoteConnection failed to
               open pipe
    [  +45 ms] <- compile package:willtenn/main.dart
    [  +66 ms] executing: C:\Users\risha\AppData\Local\Android\sdk\platform-tools\adb.exe version
    [ +123 ms] Android Debug Bridge version 1.0.41
                        Version 30.0.4-6686687
                        Installed as C:\Users\risha\AppData\Local\Android\sdk\platform-tools\adb.exe
    [   +6 ms] executing: C:\Users\risha\AppData\Local\Android\sdk\platform-tools\adb.exe start-server
    [  +79 ms] Building APK
    [  +32 ms] Running Gradle task 'assembleDebug'...
    [   +4 ms] gradle.properties already sets `android.enableR8`
    [  +11 ms] Using gradle from C:\Users\risha\development\flutter\willtenn\android\gradlew.bat.
    [   +3 ms] C:\Users\risha\development\flutter\willtenn\android\gradlew.bat mode: 33279 rwxrwxrwx.
    [  +27 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
    [ +155 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
    [   +1 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)
    [   +7 ms] executing: [C:\Users\risha\development\flutter\willtenn\android/]
    C:\Users\risha\development\flutter\willtenn\android\gradlew.bat -Pverbose=true -Ptarget-platform=android-x86
    -Ptarget=C:\Users\risha\development\flutter\willtenn\lib\main.dart -Ptrack-widget-creation=true
    -Pfilesystem-scheme=org-dartlang-root assembleDebug
    [+4555 ms] > Task :app:compileFlutterBuildDebug UP-TO-DATE
    [   +3 ms] > Task :app:packLibsflutterBuildDebug UP-TO-DATE
    [   +1 ms] > Task :app:preBuild UP-TO-DATE
    [   +1 ms] > Task :app:preDebugBuild UP-TO-DATE
    [  +81 ms] > Task :app:checkDebugManifest UP-TO-DATE
    [   +2 ms] > Task :app:generateDebugBuildConfig FAILED
    [   +1 ms] 4 actionable tasks: 1 executed, 3 up-to-date
    [   +4 ms] FAILURE: Build failed with an exception.
    [   +4 ms] * What went wrong:
    [   +3 ms] Execution failed for task ':app:generateDebugBuildConfig'.
    [   +2 ms] > java.nio.file.AccessDeniedException:
    C:\Users\risha\development\flutter\willtenn\build\app\generated\source\buildConfig\debug\com\example\willtenn
    [   +2 ms] * Try:
    [   +1 ms] 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.
    [   +2 ms] * Get more help at https://help.gradle.org
    [   +1 ms] BUILD FAILED in 4s
    [ +618 ms] Running Gradle task 'assembleDebug'... (completed in 5.5s)
    [  +22 ms] Exception: Gradle task assembleDebug failed with exit code 1
    [   +9 ms] "flutter run" took 7,496ms.
    [  +21 ms]
               #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
               #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:607:7)
               <asynchronous suspension>
               #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:977:18)
               #3      _rootRunUnary (dart:async/zone.dart:1198:47)
               #4      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
               #5      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
               #6      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
               #7      Future._propagateToListeners (dart:async/future_impl.dart:725:32)
               #8      Future._completeWithValue (dart:async/future_impl.dart:529:5)
               #9      _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
               #10     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
               #11     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
               #12     _rootRunUnary (dart:async/zone.dart:1198:47)
               #13     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
               #14     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
               #15     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
               #16     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
               #17     Future._completeWithValue (dart:async/future_impl.dart:529:5)
               #18     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
               #19     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
               #20     AndroidDevice.isLocalEmulator (package:flutter_tools/src/android/android_device.dart)
               #21     _rootRunUnary (dart:async/zone.dart:1198:47)
               #22     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
               #23     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
               #24     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
               #25     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
               #26     Future._completeWithValue (dart:async/future_impl.dart:529:5)
               #27     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
               #28     _rootRun (dart:async/zone.dart:1190:13)
               #29     _CustomZone.run (dart:async/zone.dart:1093:19)
               #30     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
               #31     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
               #32     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
               #33     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
               #34     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
               #35     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
    
    
    [ +200 ms] ensureAnalyticsSent: 179ms
    [   +3 ms] Running shutdown hooks
    [   +2 ms] Shutdown hook priority 4
    [   +4 ms] Shutdown hooks complete
    [   +1 ms] exiting with code 1
    

    Here is my flutter doctor -v

    [√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.19042.1052], locale en-GB)
        • Flutter version 1.22.6 at C:\flutter
        • Framework revision 9b2d32b605 (5 months ago), 2021-01-22 14:36:39 -0800
        • Engine revision 2f0af37152
        • Dart version 2.10.5
    
    
    [√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
        • Android SDK at C:\Users\risha\AppData\Local\Android\sdk
        • Platform android-30, build-tools 30.0.2
        • ANDROID_HOME = C:\Users\risha\AppData\Local\Android
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
        • All Android licenses accepted.
    
    [√] Android Studio (version 4.0)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin installed
        • Dart plugin version 193.7547
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    
    [√] VS Code (version 1.57.1)
        • VS Code at C:\Users\risha\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.23.0
    
    [√] Connected device (1 available)
        • sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
    
    • No issues found!
    

    I have been looking for a solution for about two weeks now, and I still have not found the problem. Thank you for any help!

    THE ANSWER IS POSTED IN THE COMMENTS

    • Bogdan Android
      Bogdan Android almost 3 years
      Looks like your problem could be there: java.nio.file.AccessDeniedException: C:\Users\risha\development\flutter\willtenn\build\app\genera‌​ted\source\buildConf‌​ig\debug\com\example‌​\willtenn , looks like flutter have no permission to write in this directory