After updating the flutter to 1.12.13+hotfix.8, Flutter gives strange errors on release build, but works perfectly fine in debug build
Error :
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'intent'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or
by setting the sdk.dir path in your project's local properties file at
'/Users/niyantras/tools/flutter/.pub-cache/hosted/pub.dartlang.org/intent-
1.1.0/android/local.properties'.
* 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
Flutter doctor :
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.42.0)
[✓] Connected device (1 available)
• No issues found!
Can someone help me in figuring out, thanks for the help.
flutter clean
flutter pub cache repair
let me know if the issue persists
check here, it's closed issues of flutter
Check for compilesdkversion everywhere in the folder and match it with one in android/app/build.gradle
Related
just created new flutter project with the command flutter create test.
When start it failed with this error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file 'D:\sandbox\mobile-app\sheba\testapp\android\settings.gradle' (C:\Users\grebe\.gradle\caches\7.4\scripts\ea4ydi90mwjg9g63m7r6nimmx).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63
* 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 5s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Device: Emulated Android 12
Flutter doctor output is:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.10, on Microsoft Windows [version 10.0.22621.1105], locale fr-FR)
[√] 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 Build Tools 2019 16.11.15)
[!] Android Studio (version 2022.1)
X Unable to find bundled Java version.
[√] VS Code (version 1.74.3)
[√] Connected device (4 available)
[√] HTTP Host Availability
! Doctor found issues in 1 category.
Thanks for help :)
run " --flutter doctor " and share the result
is it your first project with flutter on your device ?
Also mention what is your device and it's OS version.
Problem: [!] Android Studio (version 2022.1) X Unable to find bundled Java version.
answer : Go to "C:\Program Files\Android\Android Studio" and then copy the content of jbr and paste the content into jre folder run doctor again
just change your gradle version to 7.6 .
follow the steps 1android>gradle>gradle-property
check this line distributionUrl=https://services.gradle.org/distributions/gradle-7.6-all.zip)
this 7.6 should not be 7.4 or less
for using data in clients I added a hive package to my project
dependencies:
hive: ^2.2.3
hive_flutter: ^1.1.0
dev_dependencies:
hive_generator: ^1.1.3
build_runner: ^2.3.0
after the pub and running debug I got this error
**
Launching lib\main.dart on sdk gphone x86 in debug mode...
lib\main.dart:1
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':path_provider_android'.
Could not resolve all files for configuration ':path_provider_android:classpath'.
Could not find builder-3.3.0.jar (com.android.tools.build:builder:3.3.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.3.0/builder-3.3.0.jar
Could not find protos-26.3.0.jar (com.android.tools.analytics-library:protos:26.3.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/26.3.0/protos-26.3.0.jar
Failed to notify project evaluation listener.
2
Could not get unknown property 'android' for project ':path_provider_android' of type org.gradle.api.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 3s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
**
Flutter is already up to date on channel stable
Flutter 3.3.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision eb6d86ee27 (8 days ago) • 2022-10-04 22:31:45 -0700
Engine • revision c08d7d5efc
Tools • Dart 2.18.2 • DevTools 2.15.0**
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.4, on Microsoft Windows [Version 10.0.19042.2006], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Enterprise 2022 17.0.4)
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.72.1)
[√] Connected device (4 available)
[√] HTTP Host Availability
Also, I downloaded protos-26.3.0.jar and builder-3.3.0.jar and run these files but it did not happen.
what I missed?
maybe hive_flutter is an older project and not the updated one,
remove hive_flutter try to Go with hive only.
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.