Exception throws while Run the flutter plugin - flutter

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

Related

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

how to correct this error : Gradle task assembleDebug failed with exit code 1?

can someone tell me why i keep having this bug in android studio , i installed the latest gradle and still can't fix it and also i ran flutter doctor -v , the output is below .i also tried flutter clean but couldn't find the rebuild option .
here's the error log :
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\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 37s
Exception: Gradle task assembleDebug failed with exit code 1
here is my flutter doctor -v output :
[√] Flutter (Channel master, 2.3.0-13.0.pre.145, on Microsoft Windows [Version
10.0.19041.985], locale en-CA)
• Flutter version 2.3.0-13.0.pre.145 at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fdb1fb184d (3 days ago), 2021-05-24 22:04:02 -0700
• Engine revision b1385c0df1
• Dart version 2.14.0 (build 2.14.0-145.0.dev)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X cmdline-tools component is missing
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more
details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.2.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 11.0.8+10-b944.6842174)
[√] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 •
Android
8.0.0 (API 26) (emulator)
• Chrome (web) • chrome • web-javascript • Google
Chrome 90.0.4430.212
• Edge (web) • edge • web-javascript • Microsoft
Edge 90.0.818.66
! Doctor found issues in 1 category.
Try running flutter doctor --android -licenses in flutter console
and accept the licenses.

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

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!

Unable to run flutter app in android studio

I created a new flutter project and when run it, it gives that error
Target kernel_snapshot failed: Exception: The value of -DDartDefines is not formatted correctly.
The value must be a JSON-encoded list of strings but was:
[flutter.inspector.structuredErrors=true]
build failed.
FAILURE: Build failed with an exception.
* Where:
Script 'D:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882
* 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
Exception: Gradle task assembleDebug failed with exit code 1
I have tried flutter clean, and same error
flutter doctor log :
D:\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel master, v1.16.4-pre.69, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
• Flutter version 1.16.4-pre.69 at D:\flutter
• Framework revision 19e7db585d (4 months ago), 2020-04-01 11:16:01 -0700
• Engine revision c9506cb8e9
• Dart version 2.8.0 (build 2.8.0-dev.18.0 eea9717938)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\user\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)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[!] VS Code (version 1.47.2)
• VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
Process finished with exit code 0
According to what flutter doctor is giving you the problem might be related to Android Sdk not installed or not configured really well:
Flutter provides a command to update the Android SDK path: Use
flutter config --android-sdk <path-to-your-android-sdk-path>
You can install it directly from Android Studio:
To open the SDK Manager from Android Studio, click Tools > SDK Manager or click SDK Manager in the toolbar. You might have to uncheck "hide obsolete packages" and install the packages that were considered obsoletes.
Or you can install it from this link and configure it like I said before:
https://www.google.com/url?sa=t&source=web&rct=j&url=https://android-sdk.fr.uptodown.com/windows&ved=2ahUKEwi-itWCkuzqAhXTZTUKHa29CRMQFjACegQIAhAB&usg=AOvVaw1QSSVVMrZzFltXvboDbTeQ

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.