unable to run flutter app on real device using vs code - flutter

for the first time using flutter on vs code, I tried running the app on my mobile without an emulator so after enabling the USB debugger and connecting the device. clicking the start debugging icon won't display the app on the screen except for an error in the console.
Launching lib\main.dart on SM G935F in debug mode... lib\main.dart:1
FAILURE: Build failed with an exception.
What went wrong: Could not open settings generic class cache for settings file
'D:\flutterproj\vstest\flutter_application_1\android\settings.gradle'
(C:\Users\abdal.gradle\caches\6.7\scripts\1fnwrr8g4rohfp291nvlxj5qe).
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 1m 13s Exception: Gradle task assembleDebug failed
with exit code 1 Exited (sigterm)
Just to let you know I already have the flutter SDK downloaded as well as the other things.
and the code has no error it's the same as when you open the flutter app for the first time
please tell me if you need more info.
thanks

Related

Flutter app doesn't run FAILURE: Build failed with an exception

So I installed flutter and I initialized an app I run the app it
say's
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
Where: Build file 'C:\src\projects\myapp\android\app\build.gradle' line: 26
What went wrong: A problem occurred evaluating project ':app'.
Could not open dsl generic class cache for script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle'
(C:\Users\admin.gradle\caches\7.5\scripts\6retkvb9i1tmrre8676t631o1).
Unexpected lock protocol found in lock file. Expected 3, found 0.
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
so I checked if I have problem with installation with flutter doctor and it
show's this
I already have system image and when I run the program it always shows the error
and the app doesn't run I already tried setting the JAVA_HOME and copying the jbr files to
jre but still get the error. Thank you for your response
you can visit these two post to solve your problem :
1- first error : Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. Flutter 2.0
2-for second error : Visual Studio not installed; this is necessary for Windows development

Gradle failed to build on a new hardware using the same installation method

After I copy my project to a new laptop, I tried to run a flutter project in vscode. however during debugging gradle failed to build and gave me this in the debug console
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
lib\main.dart:1
FAILURE: Build failed with an exception.
What went wrong:
Could not open settings generic class cache for settings file 'D:\PROJECT_NAME\android\settings.gradle' (C:\Users\Folder.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 1s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I have no idea what went wrong since the JDK is the same version (19) as my old laptop
edit: I tried to download a new gradle, and create a new empty project, and I still get the same error
Running a flutter project on the new laptop

erron on vscode gradle

i have one error that's is impossible for me to solve, what kind of problem is this shit?
I've searched for many ways to fix this but i don't have found it nothing for this problem on vscode only for android studio, someone can help me?
enter image description here
this impossibilite me to deploy my application in a on virtual android always stop in this error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
> Resource compilation failed. Check logs for details.
* 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 4s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
You should run
flutter run --verbose
and try to upload new image error.
I've found it whats happening man,in flutter in pub dev they gave changed the ways of splash screen it's not using the drawables anymore,we must create in lib paste the archive called Splash-Screen.dart and code all the splash screen rsrsrs but i'll appreciate your bro,and i'm very thankfull for that.

Flutter Exception: Gradle task assembleDebug failed with exit code 1. when hotspot is on

An error appears when I run my flutter app with hotspot on:
FAILURE: Build failed with an exception.
* What went wrong:
The first result from the daemon was empty. Most likely the process died immediately
after connection.
* 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 need the hotspot because I want to run the app on physical device using pair wifi to connect to the same wireless network.
What's wrong?
I resolved my issue when I updated gradle in my flutter project by:
Create a new temp project with the latest version of Flutter.
In the temp project open android/gradle/wrapper/gradle-wrapper.properties and check the distributionUrl. Update your old project to use the same one.
For me today the distributionUrl looks like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
Rerun your app. It has to download the new version of gradle to the android/.gradle directory so the first time might take a while.

Flutter Update issues

My flutter code works perfectly fine and I have run multiple tests on it.
I just decided to install the new VS code updates and restart my VS code application.
All of the sudden I started having the error below and I have searched the entire code for the method but none was found
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart
../../../flutter_windows_1.22.3-stable/flutter/packages/flutter/lib/src/widgets/navigator.dart:3783:32: Error: Getter not found: 'deoNotPop'.
case RoutePopDisposition.deoNotPop:
^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\temp\flutter_windows_1.22.3-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\temp\flutter_windows_1.22.3-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 26s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Someone, please help me
It looks like you may have inadvertedly modified a Flutter SDK file:
flutter/packages/flutter/lib/src/widgets/navigator.dart
case RoutePopDisposition.deoNotPop:
This should say doNotPop and not doeNotPop. Removing the e and saving the file should fix it. You can run git status in your Flutter SDK to see if there are other changes that may need reverting.