I was running my flutter app yesterday afternoon and it was running well
but yesterday at night, I tried to run the app but the build failed with the error message being shown up
The Error Message
/C:/flutter-SDK/flutter_windows_v1.12.13+hotfix.8-stable/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.2/lib/src/client.dart:35:23: Error: Method not found: 'createClient'.
factory Client() => createClient();
^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter-SDK\flutter_windows_v1.12.13+hotfix.8-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\flutter-SDK\flutter_windows_v1.12.13+hotfix.8-stable\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 1m 42s
Exception: Gradle task assembleDebug failed with exit code 1
=============================================================================================
flutter doctor:
[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.19041.685], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.52.1)
[√] Connected device (1 available)
• No issues found!
run below command:
flutter packages pub run build_runner build --delete-conflicting-outputs
Related
The whole code was working well last week, and now I try to open the same project and run the flutter build apk
It shows below error
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':location'.
> Could not load compiled classes for build file 'D:\\flutter.pub-cache\\hosted\\pub.dartlang.org\\location-4.4.0\\android\\build.gradle' from cache.
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for the project ':location' of type org.gradle.api.Project.
> Could not get unknown property 'android' for the project ':location' of type org.gradle.api.Project.
* Try:
ore log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 16s
Gradle task assembly release failed with exit code 1
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
US)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.6)
[√] Android Studio (version 2021.3)
[√] Connected device (3 available)
[√] HTTP Host Availability
• No issues found!
I tried cleaning the pub cache folder and also running pub get commands, but the build is not succeeding
I got into this problem since last month. I can build APK for android-arm64, android-x86, all of them combined but not specifically for android-arm.
I use this command to build:-
flutter build apk --target-platform android-arm --analyze-size
After running this I'm getting the error:-
Building with sound null safety
Dart snapshot generator failed with exit code -2147483645
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command 'C:\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 4m 54s
Running Gradle task 'assembleRelease'... 295.9s
Gradle task assembleRelease failed with exit code 1
Output for flutter doctor is:-
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.10.3, on Microsoft Windows [Version 10.0.22000.527], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.6)
[√] Android Studio (version 2021.1)
[√] VS Code (version 1.65.0)
[√] Connected device (3 available)
[√] HTTP Host Availability
• No issues found!
I tried changing gradle versions to 6.7-all, 7.3.1-bin and 7.2-bin
I tried removing flutter folder and reinstalling it all
The problem was with flutter itself after the new update.
It is covered in this issue
I am flutter developer and I use pay plugin to integrate google pay in my app
first I was using olde kotlin version so I update to latest version
after update version of kotlin google pay button throw error I don't know what went wrong after doing flutter clean when I try to run my code it throw me error like I mention below can anyone suggess me how to deal with it
Here is error log:-
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageDebug'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
> java.lang.OutOfMemoryError (no error message)
* 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 58s
Exception: Gradle task assembleDebug failed with exit code 1
Here is my flutter doctor result:-
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 11.5.2 20G95 darwin-x64, locale
en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.2)
[✓] VS Code (version 1.59.1)
[✓] Connected device (2 available)
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\devsh\Desktop\programs_\StudioProjects\untitled\android\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Could not open proj generic class cache for build file 'C:\Users\devsh\Desktop\programs_\StudioProjects\untitled\android\app\build.gradle' (C:\Users\devsh\.gradle\caches\6.7\scripts\67wpoy60578g543vmv9v5k2r9).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 60
* 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 8s
Exception: Gradle task assembleDebug failed with exit code 1
and this is not it. I have installed android studio still my flutter doctor shows me that I haven't installed it yet and also there is some license issue I don't know how to solve
this is my result of flutter doctor
C:\Users\devsh>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 10.0.19042.985], locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
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.
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[√] VS Code (version 1.55.2)
[√] Connected device (2 available)
! Doctor found issues in 3 categories.
For the Android license issue, what happens when you run flutter doctor --android-licenses on the command line? Hopefully, it'll run you through the steps to accept the licenses.
For the unsupported class issue, does running a Gradle clean solve the problem? To do this, you should be able to navigate to the projects android directory on the command line and run gradlew clean.
I'm trying to perform my first run of a test app on flutter via Genymotion, but I get nothing except this message in console:
Launching lib\main.dart on Motorola Moto X in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.5.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
Required by:
project :
* 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 26s
Finished with error: Gradle task assembleDebug failed with exit code 1
Also (it may be helpful, I think), under the build menu, I don't find some practical sub-menus; such as build, clean, or ...
What could be the problem?
any help is really appreciated!
Since #TaufikNurRahmanda needed the response of flutter doctor and flutter clean commands as more details, I am adding them as an edit;
flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.7, on Microsoft Windows [Version 10.0.10586], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed
instructions.
[√] Android Studio (version 3.4)
[√] IntelliJ IDEA Community Edition (version 2019.3)
[√] Connected device (1 available)
! Doctor found issues in 1 category.
flutter clean:
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Do not run this command from the root of your git clone of Flutter.
Also the response of flutter doctor --android-licenses may be useful (although I have Android SDK Build-tools 29.0.3 installed):
A newer version of the Android SDK is required. To update, run: C:\Users\[user]\AppData\Local\Android\android-sdk\tools\bin\sdkmanager --update
And when I run the suggested command above (sdkmanager --update), I get this:
Error: Could not find or load main class '-Dcom.android.sdklib.toolsdir=C:\Users\[user]\AppData\Local\Android\android-sdk\tools\bin\\..-XX:+IgnoreUnrecognizedVMOptions
Seems you do not accepted some android licenses. Just run:
flutter doctor --android-licenses
And accept y all licences.