Flutter clean and build fail to complete - android

Steps to Reproduce
I'm not sure there is an exact way to reproduce this issue as it seems to happen at random instances when building or running the project on a physical device.
I hope this is the right place to post this.
Here is an outline of how it occurs.
I have looked at issue #36763 and its not resolving the issue.
You run a project on an ADB connected device. The app will successfully build and/or run on the devices.
Step 1 will randomly get stuck on assembling the project. This will not complete even if you wait for hours(tried it)
Ordinarily when you have a problem you will go for flutter clean . if you try this it gets also stuck for hours with no completion.
Upon inspecting this you find a file in your assembled assets with a number like "8043e5b2" but no extension. This might be an svg, png , or jpeg image which was stripped off the extension and renamed, I found out by looking inside the file or copying it outside of build and adding the extension. This file will not rename, delete or be modified on any application on windows and yes that includes the IDEs.
The only solution that I found to delete this was to boot into safe mode with CMD and delete it from there.
If you pick to go with step 5 you are going to build the app successfully for a couple of times and then it happens again. The you have to go to safe boot to delete the build again.
Version info
$ flutter doctor -v
[√] Flutter (Channel stable, 3.3.10, on Microsoft Windows [Version 10.0.19045.2364], locale en-UK)
• Flutter version 3.3.10 on channel stable at C:\Flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 135454af32 (2 weeks ago), 2022-12-15 07:36:55 -0800
• Engine revision 3316dd8728
• Dart version 2.18.6
• DevTools version 2.15.0
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Usname\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\xxxxx\Chrome\Application\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.3)
• Android Studio at C:\xxx\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.13+0-b1751.21-8125866)
[√] VS Code (version 1.74.2)
• VS Code at C:\mypathtoinstallation\Microsoft VS Code
• Flutter extension version 3.56.0
[√] Connected device (4 available)
•X683 (mobile) • 192.168.xx.xx:xxxx • android-arm64 • Android
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.2364]
• Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.125
• Edge (web) • edge • web-javascript • Microsoft Edge 108.0.1462.54
[√] HTTP Host Availability
• All required HTTP hosts are available

Related

Missing files / Cannot resolve symbols and classes in Android folder for Flutter Project

I tried using the solutions online but nothing worked.
Deleted android folder and ran 'flutter create .'
Ran 'gradlew clean build' but the build was failed
* What went wrong:
Could not compile build file 'C:\Users\EVO.store\StudioProjects\playground2point0\android\build.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 62
Updated my JAVA_HOME variable to 'C:\Program Files\Java\jdk-18'
I honestly have no idea what to do anymore, the main.dart file works just fine. But I'd like to edit a few things for the android version.
What exactly am I missing here?
Here's what it looks like:
https://imgur.com/a/bQ4mNXx
Here's my Flutter doctor output:
[√] Flutter (Channel stable, 2.10.4, on Microsoft Windows [Version 10.0.22000.556], locale en-US)
• Flutter version 2.10.4 at C:\Users\EVO.store\Documents\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c860cba910 (3 weeks ago), 2022-03-25 00:23:12 -0500
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at C:\Users\EVO.store\AppData\Local\Android\sdk
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
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:\Users\EVO.store\AppData\Local\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
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2021.1)
• 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.11+9-b60-7590822)
[√] VS Code (version 1.65.2)
• VS Code at C:\Users\EVO.store\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)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.556]
• Chrome (web) • chrome • web-javascript • Google Chrome 71.0.3578.98
• Edge (web) • edge • web-javascript • Microsoft Edge 100.0.1185.39
[√] HTTP Host Availability
• All required HTTP hosts are available

Flutter SDK installed, but not found (windows)

Flutter Doctor -v indicates SDK is there.
(for some reason it says Android Studio is not installed)
**[√] Flutter (Channel stable, 2.2.0, on Microsoft Windows [Version 10.0.19042.985], locale en-US)
• Flutter version 2.2.0 at C:\Users\kaste\Documents\flutter
• Framework revision b22742018b (3 weeks ago), 2021-05-14 19:12:57 -0700
• Engine revision a9d88a4d18
• Dart version 2.13.0
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\kaste\AppData\Local\Android\Sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = C:\Users\kaste\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
• Java version Java(TM) SE Runtime Environment 18.9 (build 11.0.10+8-LTS-162)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] VS Code (version 1.56.2)
• VS Code at C:\Users\kaste\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.22.0
[√] Connected device (3 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212
• Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.37**
In Android Studio, I get this error message when trying to start a new Flutter App.
Android Studio error message
I can't figure out why it's not working. I can run the default Android Studio flutter app in the Android Virtual Device fine.
?
same thing happened to me when i pointed the path
as
/home/ekele/flutter_sdk/bin
it worked when i changed it to
/home/pompidou/flutter_sdk
change the path below to C:\Users\kaste\Documents\flutter
As said before, you need to set 'flutter installation directory' (you got it as can be shown at your flutter doctor -v command output:
Flutter version 2.2.0 at C:\Users\kaste\Documents\flutter.
Problem is you are setting as flutter SDK your Android SDK installation directory, which is wrong. You need to just set C:\Users\kaste\Documents\flutter instead of C:\Users\kaste\AppData\Local\Android\sdk

How do I resolve white screen on mobile browsers for flutter web app?

I'm trying to build a flutter web app. Everything works fine while developing locally on Windows 10, but when I build and deploy the app, it only works in my desktop Chrome browser. Accessing it from Android or iOS browsers gives a white screen.
Run flutter channel master.
Run flutter upgrade.
Run flutter config --enable-web.
Run flutter create mywebapp.
Run cd webapp.
Run flutter build web.
Deploy to server or host locally (e.g. cd build\web and `http-server).
Connect to server from browser on mobile device (Android/iOS).
Am I doing something wrong, or is flutter just broken?
flutter doctor -v output:
[√] Flutter (Channel master, 1.19.0-4.0.pre.67, on Microsoft Windows [Version 10.0.18362.836], locale en-CA)
• Flutter version 1.19.0-4.0.pre.67 at C:\_code\sdks\flutter
• Framework revision f2320c3b7a (14 hours ago), 2020-06-04 14:45:17 -0700
• Engine revision 859d892f1f
• Dart version 2.9.0 (build 2.9.0-13.0.dev 54adfeb93f)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\_code\sdks\android
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = C:\_code\sdks\android
• Java binary at: C:\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.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.45.1)
• VS Code at C:\Users\Brent\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.11.0
[√] Connected device (2 available)
• Web Server • web-server • web-javascript • Flutter Tools
• Chrome • chrome • web-javascript • Google Chrome 83.0.4103.97
• No issues found!
Switching to beta channel resolved the issue. After switching back to master, the issue did not return.
I also cleaned my flutter installation, but it didn't seem to have any problems, so not sure if that had any effect:
git clean -xfd
git pull
flutter doctor
Try changing master channel to dev:
flutter channel dev
flutter upgrade
flutter run -d chrome
// or flutter run -d chrome --release

My flutter app is getting stuck at "Installing build\app\outputs\apk\app.apk..." and then nothing happens

As i mentioned in the question,i cannot see anything in the console but Installing build\app\outputs\apk\app.apk... and i just cannot understand the reason because my app is working in the device. I can change the pages but the little informations that i want to see, the prints that i entered in the code are not visible and its very annoying.
Before asking here i have been looking the other questions about this problem but the answers in that questions did not worked for me so i end up asking this in here, i hope you can help me.
here is the console after i click the run button;
Launching lib\main.dart on LG H850 in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
an here is the flutter doctor
[√] Flutter (Channel stable, v1.17.0, on Microsoft Windows [Version 10.0.18362.778], locale tr-TR)
• Flutter version 1.17.0 at C:\Users\Mahir Yakup Şahin\flutter
• Framework revision e6b34c2b5c (8 days ago), 2020-05-02 11:39:18 -0700
• Engine revision 540786dd51
• Dart version 2.8.1
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\src\Android
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\src\Android
• Java binary at: C:\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 C:\Program Files\Android\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.45.0)
• VS Code at C:\Users\Mahir Yakup Şahin\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.10.1
[√] Connected device (1 available)
• LG H850 • LGH850b31f3def • android-arm64 • Android 8.0.0 (API 26)
• No issues found!
I will be very grateful for any kind of help.
And also i tried in the vscode as well, here is the result,
enter image description here
and sometimes i get an error like this;
enter image description here
Try "flutter clean", that helps in lot many cases..seems like yours is also one of those..
Also..make sure that you have enough storage space on your device (phone or emulator, whatever you re using)..the description on the second image seems like because of the storage issue.

Emulator not authorized

Disclaimer: I am a newbie to using the emulators and flutter.
Question: How do I get flutter to connect to an emulator for debugging? Or, how do I create/set-up an emulated device properly so that my android studio flutter application recognizes it as a valid device?
I am not sure if it matters but I am currently working behind a proxy server. However, I have already added the appropriate certificates to the android ide.
The emulator I created is a Pixel 2, with API-28. I set it to allow developer options.
Using the new project part of the IDE I created a new flutter project in offline mode.
I expected the application to open in debug mode on my emulator but instead it says it doesn't think any device is connected. I ran flutter doctor and this is the output I received.
F:\SDKs\flutter_windows_v1.5.4-hotfix.2-stable\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 6.1.7601], locale en-US)
• Flutter version 1.5.4-hotfix.2 at F:\SDKs\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\SWahlin-Rhoades\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• Java binary at: F:\Program Files\Android\Android Studio\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 F:\Program Files\Android\Android Studio
• Flutter plugin version 36.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[!] Connected device
• Device emulator-5554 is not authorized.
You might need to check your device for an authorization dialog.
! Doctor found issues in 1 category.
Process finished with exit code 0
I am aware of the thread device-emulator-55-is-not-authorized-android however, it didn't solve my problem. Within the thread it doesn't specify what new AVD was created in the solution and the other option of turing on developer settings didn't work.
I took another look at the Device_emulator_5554 answer and attempted to create another emulator Nexus S API 28 and I can now use it for debugging.

Categories

Resources