I just created a new flutter app and when I tried to run it on an emulator then this error message appears:
Launching libmain.dart on Android SDK built for x86 in debug mode…
Running Gradle task ‘assembleDebug’…
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:app:validateSigningDebug’.
java.util.concurrent.ExecutionException: com.android.builder.utils.SynchronizedFile$ActionExecutionException: java.io.IOException: com.android.ide.common.signing.KeytoolException: Failed to create keystore.- 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 6s
Exception: Gradle task assembleDebug failed with exit code 1
Here is my build.gradle
buildscript {
ext.kotlin_version = '1.5.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here is my gradle.properties
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
Also here is my gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip
Also here is flutter doctor -v
restult:
PS D:flutter_appsangilaflutter_application_4> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.5.2, on Microsoft Windows [Version 10.0.19042.631], locale ar-YE)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] Android Studio
[√] VS Code (version 1.62.1)
[√] Connected device (3 available)
• No issues found!
PS D:flutter_appsangilaflutter_application_4> flutter doctor -v
[√] Flutter (Channel stable, 2.5.2, on Microsoft Windows [Version 10.0.19042.631], locale ar-YE)
• Flutter version 2.5.2 at C:srcflutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 3595343e20 (6 weeks ago), 2021-09-30 12:58:18 -0700
• Engine revision 6ac856380f
• Dart version 2.14.3
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:srcSdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = C:srcSdk
• Java binary at: C:/Program Files/Android/Android Studiojrebinjava
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:Program FilesGoogleChromeApplicationchrome.exe
[√] Android Studio (version 2020.3)
• Android Studio at C:Program FilesAndroidAndroid Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] Android Studio
• Android Studio at C:/Program Files/Android/Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• android-studio-dir = C:/Program Files/Android/Android Studio
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] VS Code (version 1.62.1)
• VS Code at C:UsersAbdullahAppDataLocalProgramsMicrosoft VS Code
• Flutter extension version 3.28.0
[√] Connected device (3 available)
• sdk gphone x86 64 (mobile) • emulator-5554 • android-x64 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69
• Edge (web) • edge • web-javascript • Microsoft Edge 95.0.1020.44
• No issues found!
This is a new app and I don’t doing Google Sign-in in my app. Also This error occurs in every new application and old apps which is created and debugged before and in Android Studio or VS Code. This error occurs after formatting my pc and reinstalled windows.
2
Answers
The problem has been solved with these steps:
I am a Windows User so these steps applying in Windows.
flutter clear
then run it normally.I've done all of these steps since the problem arose and did nothing else. I don't know which of them solve the problem, but in the end everything works fine. I hope this solution helps other people because I found the problem recurring in many and none of it has been resolved. My greetings.
Change the language and region and date time format to English (United States), then restart your computer.