Tried to run the default flutter application but facing this error - flutter

FAILURE: Build failed with an exception.
What went wrong:
A problem was found with the configuration of task ':app:processDebugResources' (type 'LinkApplicationAndroidResourcesTask').
In plugin 'com.android.internal.version-check' type 'com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask' property 'androidJarInput.androidJar' specifies file 'C:\Users\samir\AppData\Local\Android\sdk\platforms\android-31\android.jar' which doesn't exist.
Reason: An input file was expected to be present but it doesn't exist.
Possible solutions:
Make sure the file exists before the task is called.
Make sure that the task which produces the file is declared as an input.
Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#input_file_does_not_exist for more details about this problem.
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 31s
This is the output I got after running flutter doctor -v
Flutter (Channel stable, 3.0.4, on Microsoft Windows [Version 10.0.22000.795], locale en-IN)
• Flutter version 3.0.4 at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 85684f9300 (3 weeks ago), 2022-06-30 13:22:47 -0700
• Engine revision 6ba2af10bb
• Dart version 2.17.5
• DevTools version 2.12.2
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at C:\Users\samir\AppData\Local\Android\sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.3)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.2.32526.322
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.2)
• 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.12+7-b1504.28-7817840)
[√] VS Code (version 1.69.1)
• VS Code at C:\Users\samir\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.44.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.795]
• Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.114
• Edge (web) • edge • web-javascript • Microsoft Edge 103.0.1264.49
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Tried running flutter run -v

Related

Flutter I can't build apk with build apk command

I build an app and trying to build apk. But the apk that I build with flutter build apk command is not working. There is a white screen coming. Today I connect my device with USB and I build it into my device in that way. This time it worked. What I have to do? What am I doing wrong? Is it can be cause of null safety or something else.
flutter doctor -v
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19044.1889], locale tr-TR)
• Flutter version 3.0.5 at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (5 weeks 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 32.1.0-rc1)
• Android SDK at C:\Users\SEZEN\AppData\Local\Android\sdk
• Platform android-33, build-tools 32.1.0-rc1
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.3)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.31702.278
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.1)
• Android Studio at C:\Program Files\Android\Android Studio1
• 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.11+9-b60-7590822)
[√] VS Code (version 1.70.1)
• VS Code at C:\Users\SEZEN\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.46.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1889]
• Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.81
• Edge (web) • edge • web-javascript • Microsoft Edge 104.0.1293.54
! Device emulator-5554 is offline.
[√] HTTP Host Availability
• All required HTTP hosts are ava
ilable
Run following command in your terminale and see error log in your console.
flutter run --release

Flutter Windows Application fails to compile

I want to debug the flutter demo application on windows x64 device.but it always fails with 1 error and 1 warning this is my Debug console :
Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
F:\flut\flutter_application_5\windows\runner\utils.cpp(52,43): error C2220: warning treated as error - no 'object' file generated [F:\flut\flutter_application_5\build\windows\runner\flutter_application_5.vcxproj]
F:\flut\flutter_application_5\windows\runner\utils.cpp(52,43): warning C4018: '>': signed/unsigned mismatch [F:\flut\flutter_application_5\build\windows\runner\flutter_application_5.vcxproj]
Exception: Build process failed.
and here is my flutter doctor log :
[flutter] flutter doctor -v
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19044.1826], locale en-US)
• Flutter version 3.0.5 at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (6 weeks 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 C:\Users\MEMPHIS\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Enterprise 2019 16.1.0)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
• Visual Studio Enterprise 2019 version 16.1.28917.181
• Windows 10 SDK version 10.0.17763.0
[√] Android Studio (version 2021.2)
• 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.12+7-b1504.28-7817840)
[√] VS Code (version 1.70.2)
• VS Code at C:\Users\MEMPHIS\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.46.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1826]
• Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.102
• Edge (web) • edge • web-javascript • Microsoft Edge 104.0.1293.63
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
exit code 0
I can debug the demo app on edge, chrome, android without any problem
so What wrong?
The (Microsoft) C++ compiler is raising a warning inside the utils.cpp file:
windows\runner\utils.cpp(52,43): warning C4018: '>': signed/unsigned mismatch
It's configured to treat warnings as errors, so the compile fails with:
windows\runner\utils.cpp(52,43): error C2220: warning treated as error - no 'object' file generated
I don't believe that /WX (warnings as errors) can be configured other than by the build script (which turns it ON).
I suspect one of two things:
The Enterprise edition of the compiler (which you have) is slightly more picky than the Community edition (which I have). You could edit the project file to turn off warnings-as-errors, or add an exception for this warning (more below).
Your compiler needs upgrading. I've got 16.11.something; you've got 16.1.something. Run the Visual Studio Installer again to upgrade it. (For example: I just ran it, and it's suggesting I upgrade from 16.11.10 to 16.11.18...).
Editing the project file
The winapp.vcxproj project file is (apparently) generated by CMake. Edit windows\CMakeLists.txt and change the following line:
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
Make it look like this:
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100" /wd4018)
I don't know where the quotes come from; you might need them. Alternatively, remove the /WX bit.

CMake Error at CMakeLists.txt:3 (project): No CMAKE_CXX_COMPILER could be found. flutter desktop

Iam trying to build a flutter desktop application .
i followed the configuration here
https://docs.flutter.dev/desktop
i installed visual studio 2022 with and add Desktop development with C++ to it .
but when i tried to run a run a desktop application it said
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_CXX_COMPILER could be found.
Exception: Unable to generate build files
here is my flutter doctor
[√] Flutter (Channel master, 3.1.0-0.0.pre.1111, on Microsoft Windows [Version 10.0.19043.1706], locale en-US)
• Flutter version 3.1.0-0.0.pre.1111 at E:\softwares\flutter\flutter_windows_2.0.5-stable\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52c47e96a3 (7 days ago), 2022-06-05 08:03:02 -0400
• Engine revision 075947bf4d
• Dart version 2.18.0 (build 2.18.0-170.0.dev)
• DevTools version 2.14.0
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc3)
• Android SDK at C:\Users\zamzam107019\AppData\Local\Android\sdk
• Platform android-31, build-tools 31.0.0-rc3
• Java binary at: E:\softwares\flutter\android studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.3)
• Visual Studio at E:\vs community
• Visual Studio Community 2022 version 17.2.32526.322
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.2)
• Android Studio at E:\softwares\flutter\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.12+7-b1504.28-7817840)
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.1706]
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.63
• Edge (web) • edge • web-javascript • Microsoft Edge 102.0.1245.39
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
and this is the cmake line that cause the error
# Project-level configuration.
cmake_minimum_required(VERSION 3.14)
project(truck_scale LANGUAGES CXX) <---
i tried too many solution but no thing succeeded
It solved when i modified Desktop development with C++ and installed Windows 10 SDK 10.0.20348.0 instead of 10.0.19041.0

I got Flutter Build time and runtime error - Execution failed for task ':background_locator:compileDebugKotlin'

I got Flutter Build time and runtime error - Execution failed for task ':background_locator:compileDebugKotlin'.
when i try to run the app i got error as below, please help me.
Please can anyone help me to how i solve this problem.
below is my flutter doctor -v output.
PS D:__> flutter doctor -v
[√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [Version 10.0.19044.1706], locale en-IN)
• Flutter version 3.0.1 at D:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fb57da5f94 (8 days ago), 2022-05-19 15:50:29 -0700
• Engine revision caaafc5604
• Dart version 2.17.1
• DevTools version 2.12.2
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\Dev_Flutter\AppData\Local\Android\sdk
• Platform android-32, build-tools 31.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32210.238
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2020.3)
• 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.10+0-b96-7249189)
[√] VS Code (version 1.67.2)
• VS Code at C:\Users\Dev_Flutter\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.40.0
[√] Connected device (4 available)
• CPH2127 (mobile) • 1cb8d2b1 • android-arm64 • Android 11 (API 30)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1706]
• Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.67
• Edge (web) • edge • web-javascript • Microsoft Edge 101.0.1210.39
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Try This command in your project directory:
Flutter Pub Upgrade
There may be an inconsistency between your imported package and the flutter version you're using. this command will upgrade your packages to the latest feasible version.
Also, Please Provide your Flutter doctor output which is helpful to find a solution.

Why I can't find Chrome as a debug target?

As you can see, there is only Windows debug.
I removed android and ios folders so it is not strange not to see them, but it's strange that I can't see Chrome.
Why there is only Windows (desktop)? Any way to debug with Chrome (or Edge)?
flutter doctor -v
[√] Flutter (Channel stable, 2.10.5, on Microsoft Windows [Version 10.0.22000.675], locale ja-JP)
• Flutter version 2.10.5 at C:\Flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5464c5bac7 (4 weeks ago), 2022-04-18 09:55:37 -0700
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at C:\Users\yukik.000\AppData\Local\Android\sdk
• Platform android-32, build-tools 32.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.11)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.32228.343
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2020.3)
• 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.10+0-b96-7249189)
[√] VS Code (version 1.67.1)
• VS Code at C:\Users\yukik.000\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.40.0
[√] Connected device (1 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.675]
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Wasn't [√] Chrome installed here before?
Try to run below command if your project is not web enabled or not Web folder inside your project
flutter config --enable-web
Then restart VsCode and run your project with available device Chrome or Edge.