Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "package_config.json does not exist" when running the project

Tags:

flutter

I am currently learning flutter. Suddenly when i try to run my project i got the error that says "D:..\android.dart_tool\package_config.json does not exist. Did you run this command from the same directory as your pubspec.yaml file?". I have checked the directory and it is correct. And there is no package_config.json when i go to the directory stated. Can someone tell me how to fix this? Or how to recreate the json file? Thank you in advance.

enter image description here

    Microsoft Windows [Version 10.0.19042.906]
(c) Microsoft Corporation. All rights reserved.

D:\FlutterProject\wndr2u>flutter run
Using hardware rendering with device AOSP on IA Emulator. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
D:\FlutterProject\wndr2u\android\.dart_tool\package_config.json does not exist.
Did you run this command from the same directory as your pubspec.yaml file?


FAILURE: Build failed with an exception.

* Where:
Script 'D:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\flutter\bin\flutter.bat'' 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 1s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                      2,703ms
Exception: Gradle task assembleDebug failed with exit code 1
like image 464
MRu Avatar asked Dec 13 '25 12:12

MRu


2 Answers

  1. Flutter clean
  2. Flutter pub get
  3. Open the project in the android module
  4. Generate APK or bundle
like image 119
Hardik Hirpara Avatar answered Dec 16 '25 08:12

Hardik Hirpara


Run Tools > Flutter > Pub Get

It worked for me

like image 40
Ismaeel Sherif Avatar answered Dec 16 '25 10:12

Ismaeel Sherif



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!