'Flutter Build Error: Process 'command 'E:\Flutter Apps\flutter\bin\flutter.bat'' finished with non-zero exit value 1

I got this error when I try to generate a signed apk in the android studio of my flutter app - Process 'command 'E:\Flutter Apps\flutter\bin\flutter.bat'' finished with non-zero exit value 1

I am able to run the app in both emulator and on my device but this error shows up only when I try to build a signed apk.

flutter doctor
[√] Flutter (Channel dev, v1.2.0, on Microsoft Windows [Version 10.0.17763.253], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.3)
[√] VS Code (version 1.30.2)
[√] Connected device (1 available)

• No issues found!

Any way to fix this?

Tried flutter clean

android studio Build > clean project and rebuild project(same error)

I am doing Build > Generated signed apk > apk > release > V1(Jar signature) > Finish to build the app



Solution 1:[1]

I had the same problem after this command flutter upgrade and upgrading from V 1.22 to V 1.27.
Exactly what I did, I went to pubspec.yaml then pub-get & pub-upgrde I found there's many outdated packages then I tried pub-outdated and the AS failed to upgrade it, the it's suggests to me to run this command flutter pub upgrade --major-versions and I saw that it's successfully downloaded and installed outdated packages, Then I do Invalided Caches & restarted AS because I found it's cached about 5GB on C partition, and finally I run the app normally again without any problems.

Solution 2:[2]

  • check if you have any assets is not founded by pubspec.yaml maybe for typo you will get Waring for that after packages get

  • check AndroidX compatibilities in this Flutter app for help show this

Solution 3:[3]

Hi Please check any error in your dart files thats may be cause during error while build

Solution 4:[4]

I solved that trouble with these steps :

  1. flutter clean
  2. delete folder ".gradle" in your projectdir>android>.gradle
  3. delete pubspec.lock
  4. update your gradle to 4.1.0 at projectdir>android>build.gradle
  5. update your gradle distributionUrl to 6.5.1 at projectdir>android>app>gradle>wrapper>gradle-wrapper.properties
  6. restart your IDE
  7. flutter pub get

after that several steps above, running flutter build or flutter run wouldn't be a problem anymore. sometimes step 4 n 5 are not necessary and still solved the problem.

Solution 5:[5]

Flutter clean worked for me perfectly

Solution 6:[6]

You can try reconfiguring the Flutter SDK path in Android Studio's File | Settings | Languages ??& Frameworks | Flutter.

I have just encountered the same problem and solved it successfully with this method.

Solution 7:[7]

For me this command solved:

flutter pub upgrade --major-versions

Solution 8:[8]

I just solved it! It has to deal with the "- assets/images/" line inside pubsec.yaml, I commented it and it works just fine!

Solution 9:[9]

Guys there is no such need. The thing is the error is just a exit code. The main error is above in the logs. You can just see it by scrolling above.

Solution 10:[10]

stop the antivirus for some time if installed. it will work.

Solution 11:[11]

You probably have errors in your code. Build in verbose mode using command flutter build apk --release -vv and check if there is any error.

Solution 12:[12]

I encountered the same problem. And I run "flutter clean" in the terminal. Then the answer was like this ".packages does not exist. Did you run "flutter pub get" in this directory?". When I run "flutter pub get", it solved my problem.

Solution 13:[13]

This solution solved my problem:

My android/build.gradle:

buildscript {
ext.kotlin_version = '1.4.21'
repositories {
    jcenter()
    google()
}

dependencies {
    classpath 'com.android.tools.build:gradle:4.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

}

Run flutter clean command in terminal. And delete build folder from android/app path.

Then run your project successfully.

Solution 14:[14]

In my case nothing worked. Then I deleted the flutter/bin/cache folder and in my command line I ran flutter command that downloads the Dart SDK. After download, setting up the flutter folder path in Flutter SDK Path in Android Studio -> Preferences -> Languages and Frameworks -> Flutter , then click Apply -> Ok, solves the error.

Solution 15:[15]

I encounter the same message and go to Android Studio's setting :

Language & Framework -> Flutter -> Tick "Enable Verbose logging" , and run the build again the check the actual root cause .

In my case the root cause is recursive path in android/build folder, I delete the build folder and problem solved.

Solution 16:[16]

  1. go to your root directory of flutter project by using cmd command.

  2. write the command flutter clean, then from your android get dependencies to rebuild the cleaned.

if not solved, go to your pubspec.yaml cheek your flutter asset indentation. eg

flutter:

uses-material-design: true

assets:

  • images/momo.jpg

it works for me absolutely.

Solution 17:[17]

for me

  1. i deleted the pubspec.lock
  2. flutter clean
  3. flutter pub get
  4. then i figuer out an sdk error i switch my sdk version to 31

Solution 18:[18]

Check if any files in lib folder have

import 'dart.html';
import 'dart.io';

Remove them and try again

Solution 19:[19]

open your terminal and run this code

flutter upgrade

hopefully problem solved