First Flutter gradle build failed (what went wrong:- java/lang/Throwable$WrappedPrintWriter) - flutter

I am trying to build first flutter project only and it shows gradle build failed, I don't understand why is this happening I searched a lot and no solution worked for me. I am started working on flutter again after some time.
In flutter doctor everything shows fine, pug get is working.
I did flutter upgrade and then run and still it is not working.
Can somebody help?
FAILURE: Build failed with an exception.
* What went wrong:
java/lang/Throwable$WrappedPrintWriter
* 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
Exception: Gradle task assembleDebug failed with exit code 1
flutter doctor -v
[√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.18363.1198], locale en-US)
• Flutter version 1.22.4 at D:\flutter
• Framework revision 1aafb3a8b9 (3 weeks ago), 2020-11-13 09:59:28 -0800
• Engine revision 2c956a31c0
• Dart version 2.10.4
• Pub download mirror https://pub.dev
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at D:\Android\SDK
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = D:\Android\SDK
• Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at D:\Program Files\Android\Android Studio
• Flutter plugin version 48.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.51.1)
• VS Code at C:\Users\vishnu Agarwal\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.16.0
[√] Connected device (1 available)
• SM G770F (mobile) • RF8N217YVLX • android-arm64 • Android 10 (API 29)
• No issues found!

Related

Flutter app on MacOS return flutter.gradle error

I am trying to run my flutter app on MacOS but it returns following error
Script '/Users/macbookair/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1156
Steps to Reproduce
Execute flutter run
Tried flutter clean
Tried flutter pub get
Tried flutter pub upgrade
Deleted .build build .idea pubspec.lock .dart_tools etc.
re-cloned my app from repository
Expected results:
App running!
Actual results:
FAILURE: Build failed with an exception.
* Where:
Script '/Users/macbookair/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1156
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/macbookair/flutter/bin/flutter'' 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 3s
Exception: Gradle task assembleDebug failed with exit code 1
flutter doctor -v
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-arm, locale en)
• Flutter version 3.0.5 at /Users/macbookair/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (4 days ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/macbookair/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.12+0-b1504.28-7817840)
[✓] VS Code (version 1.69.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.44.0
[✓] Connected device (3 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12
(API 32) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.4
21F79 darwin-arm
• Chrome (web) • chrome • web-javascript • Google
Chrome 103.0.5060.114
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!

Flutter 2 build project: Error: The method 'SpinKitPouringHourglass' isn't defined for the class '_LoadingIndicatorState'

I am trying to start my project with android studio but an error occurred whereas it was functionnal yesterday.
AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_easyloading-3.0.0/lib/src/widgets/indicator.dart:166:22: Error: The method 'SpinKitPouringHourglass' isn't defined for the class '_LoadingIndicatorState'.
- '_LoadingIndicatorState' is from 'package:flutter_easyloading/src/widgets/indicator.dart' ('/C:/Users/[MYUSER]/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_easyloading-3.0.0/lib/src/widgets/indicator.dart').
Try correcting the name to the name of an existing method, or defining a method named 'SpinKitPouringHourglass'.
_indicator = SpinKitPouringHourglass(
^^^^^^^^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\lib\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\lib\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 11s
Exception: Gradle task assembleDebug failed with exit code 1
What I have already done:
reinstalled flutter SDK
reinstalled Android Studio
flutter clean
remove the build folder
remove the pubseck.lock
flutter pub get
flutter pub upgrade
flutter pub outdated
flutter doctor:
C:\lib\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [version 10.0.19042.1165], locale fr-FR)
• Flutter version 2.2.3 at C:\lib\flutter
• Framework revision f4abaa0735 (8 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\[MY_USER]\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\Program Files\Java\jdk1.8.0_291\bin\java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[!] Android Studio (version 4.1.0)
• 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
X Unable to determine bundled Java version.
• Try updating or re-installing Android Studio.
[√] VS Code (version 1.59.1)
• VS Code at C:\Users\[MY_USER]\AppData\Local\Programs\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159
• Edge (web) • edge • web-javascript • Microsoft Edge 92.0.902.84
! Doctor found issues in 1 category.
Process finished with exit code 0
What should I do to fix this error ?
I have the same question too.
flutter_easyloading was working well before.
SO I find "import 'package:flutter_spinkit/flutter_spinkit.dart';" in the indicator.dart in the flutter_easyloading 3.0.0.
BUT the flutter_spinkit has published a new version 5.1.0 and see the ChangeLog, I find the log "Renamed SpinKitPouringHourglass -> SpinKitPouringHourGlass for correctness".
YES, the flutter_easyloading MUST modify too for fixing this bug.
You are using a method that does not exist with a plugin: flutter_easyloading.
Flutter easly loading is the problem.
good evening to you

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. These error comes when I run flutter project in emulator

I create a empty flutter application and I got this error when I run this in android emulator. I already installed java, AD (4.1),git but don't know what happens. If anyone has idea let me know. Thanks :)
error log
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following SDK components:
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
Install the missing components using the SDK manager in Android Studio.
* 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
flutter doctor full summary
PS F:\Flutter\flutter_application_1> flutter doctor -v [√] Flutter (Channel stable, 2.0.0, on Microsoft Windows [Version 10.0.19042.804], locale en-US)
• Flutter version 2.0.0 at C:\src\flutter
• Framework revision 60bd88df91 (16 hours ago), 2021-03-03 09:13:17 -0800
• Engine revision 40441def69
• Dart version 2.12.0
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\vaagm\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• 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.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0)
• 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
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.53.2)
• VS Code at C:\Users\vaagm\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.20.0
[√] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 5.1.1 (API 22) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.190
• Edge (web) • edge • web-javascript • Microsoft Edge 88.0.705.81
• No issues found!
The solution is there in the error message.
you need to install following SDK components:
build-tools; 28.0.3 Android SDK Build-Tools 28.0.3
platforms; android-29 Android SDK Platform 29
Install the missing components using the SDK manager in Android Studio.
Go to File>settings>Appearance & Behaviour>System settings>Android SDK> And install the mentioned sdk build tools,platform.
After some searching, according to this question, you need to accept android licenses. Check this out and let us know your results :) Hope it will help

Exception throws while Run the flutter plugin

Improperly formatted define flag: memory
FAILURE: Build failed with an exception.
Where: Script 'C:\newfluttersdk\flutter\packages\flutter_tools\gradle\flutter.gradle'
line: 896
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\newfluttersdk\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 2s Running Gradle task 'assembleDebug'... Running
Gradle task 'assembleDebug'... Done 3.3s
Exception: Gradle task assembleDebug failed with exit code 1
flutter doctor -v
[√] Flutter (Channel stable, 1.20.1, on Microsoft Windows [Version
10.0.18362.657], locale en-IN)
• Flutter version 1.20.1 at C:\newfluttersdk\flutter
• Framework revision 2ae34518b8 (5 days ago), 2020-08-05 19:53:19 -0700
• Engine revision c8e3b94853
• Dart version 2.9.0
[√] Android toolchain - develop for Android devices (Android SDK
version 29.0.3)
• Android SDK at C:\Users\DeepikaRavi\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• 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 version 48.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code, 64-bit edition (version 1.45.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.11.0
[√] Connected device (1 available)
• vivo Y51L (mobile) • 34d9bc20 • android-arm64 • Android 5.0.2 (API 21)
• No issues found!
Thanks in Advance.
#deepika can you please try this commands
flutter upgrade --force
flutter pub cache repair
cd <YOUR APP FOLDER>
flutter clean```
You should upgrade version android.
like that
android/build.gradle
classpath 'com.android.tools.build:gradle:4.1.1'
android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
delete you yamillock file and run get pub it solve the issue for me

How to fix 'Error running gradle # line 24'

Running my first Flutter program, encountered this issue. Unable to resolve it by adding Google().
Error Message
*Error running Gradle:
ProcessException: Process "C:\Users\hariharan\Desktop\helloflutter\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
*Where:
Build file 'C:\Users\hariharan\Desktop\helloflutter\android\build.gradle' line: 24
*What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
Failed to find target with hash string 'android-28' in: C:\Users\hariharan\AppData\Local\Android\sdk
*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 15s
Command: C:\Users\hariharan\Desktop\helloflutter\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Running flutter doctor -v
[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.17134.829], locale en-SG)
• Flutter version 1.5.4-hotfix.2 at C:\flutter_windows_v1.5.4-hotfix.2-stable\flutter
• Framework revision 7a4c33425d (8 weeks ago), 2019-04-29 11:05:24 -0700
• Engine revision 52c7a1e849
• Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at C:\Users\hariharan\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• ANDROID_HOME = C:\Users\hariharan\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin version 36.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[√] VS Code (version 1.35.1)
• VS Code at C:\Users\hariharan\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.1.0
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
No issues found!
From the error: Failed to find target with hash string 'android-28', it seems that it's unable to find build tools for version 28. If you're using Android Studio, you can go through Tools > SDK Manager > Android SDK and make sure that you've got your Android SDKs up-to-date.