Finished with non-zero exit value 1
In case, you are getting this error, there could multiple reasons for this. To solve this error, we have covered all the possible solutions here.
Clean & Re-build project
- Open the terminal in Android studio.
- Enter flutter clean command in terminal.
- After finish processing, hit second command flutter pub get.
- Run your project.
Removing Some local file and folder in your project
- Open your project folder and show all hidden files and folder.
- Then removing .dart_tool folder, .idea folder, build folder, .packages, .pubspec.lock files in project root directory.
- Open android folder and removing .gradle folder, .idea folder, local.properties files.
- At the end, restart your project and then open pubspec.yaml file click in to pub get and run.
Removing “dart.js”
- If you are using ‘import dart:js’ in any .dart file, kindly remove it.
Recheck your full project’s path
- Make sure that your full project path is less than 80 characters.
Disable antivirus
- Turn off if anti virus is on, before build.
- Anti virus disable in Windows.
- Select Start > Settings > Update & Security > Windows Security > Virus & threat protection > Manage settings (or Virus & threat protection settings in previous versions of Windows 10).
- Switch Real-time protection to Off. Note that scheduled scans will continue to run.
- Anti virus disable in mac.
- Access the Mac menu bar, and there you should see the antivirus icon.
- Right-click it or just left click and a drop-down menu appears.
- Click the ideal function such as
Disable or Stop and if it asks for any confirmation, hit “Yes” or “Confirm.”.