How to solve "Waiting for a connection from Flutter on device..." - flutter

When I run the default test app on my devices all the console outputs is
Waiting for a connection from Flutter on SM N950F...
I thought the problem could be my physical device but I realized this isn't the case I tested it on two emulators and I get the same output.
When I run flutter doctor -v my output is:
[√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18362.959], locale en-ZA)
• Flutter version 1.17.5 at C:\src\flutter\flutter
• Framework revision 8af6b2f038 (3 weeks ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
• Android SDK at C:\Users\Jimmy\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Connected device (1 available)
• SM N950F • _myDeviceID_ • android-arm64 • Android 9 (API 28)
• No issues found!

Ok, so I've managed to figure something out.- I'll be answering my own question:
My current version of Android Studio (version 4.0.1) just doesn't want to run an app straight from the UI so you kinda have to brute force it from the terminal.
Make sure that your API level you're running your device on is the same as what you have installed on Android Studio.
1.1 Click on the SDK Manager button around the top right corner of AS (The icon is a box with a down arrow next to it)
1.2 Choose the same API level as your device, (When I didn't do this I had a partial install and it took some time to compile), then click apply and wait for it to install.
We're going to run the project to our avd or mobile device from the directory of ourproject.
2.1 Open up the Command Prompt (preferably as Admin), and chage the directoy to where your project is, the command should look something like this
cd Documents\AndroidStudioProjects\your_flutter_app_folder
2.2 Finally type the command flutter run it will take about 1 minute to compile, first time round.

Related

Vscode showing white theme/text in my flutter dart code

In the image above you can see that the whole dart code is showing white lines and this happened after my laptop accidently turned off while I was running the code.
The first error it gave was corrupted .git/packed-ref file which i fixed but this one isn't going away, other file type is showing their repective color theme only the .dart file is doing this. and also dart analyzer isn't working too
//Flutter doctor -v
[√] Flutter (Channel stable, 2.8.0, on Microsoft Windows [Version 6.3.9600], locale en-US)
• Flutter version 2.8.0 at D:\flutter\Sdk\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cf44000065 (8 weeks ago), 2021-12-08 14:06:50 -0800
• Engine revision 40a99c5951
• Dart version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
• Android SDK at C:\Users\bright\AppData\Local\Android\sdk
• Platform android-31, build-tools 31.0.0-rc2
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[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 (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.63.2)
• VS Code at C:\Users\bright\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.34.0
[√] Connected device (1 available)
• Edge (web) • edge • web-javascript • Microsoft Edge 97.0.1072.69
! Doctor found issues in 1 category.
I don't exactly know what the problem is, since it isn't showing me any error. Please what do i do?
I think there is something wrong with the Dart extension (perhaps some files are corrupt), but uninstalling/re-installing it does not remove the files from disk and re-download it.
I would try uninstalling the Dart extension, then go into your %USERPROFILE%\.vscode\extensions folder and delete any dart-code.dart-code folders, and then re-launch VS Code and re-install it.
If that doesn't solve it, please file an issue at https://github.com/Dart-Code/Dart-Code. Thanks!

flutter doctor is ok but this " No devices found with name or id matching 'emulator-5554' " show at my console

No devices found with name or id matching 'emulator-5554'
idk how to fix it ,flutter doctor is ok,but when I run my program on emulator at console show this " No devices found with name or id matching 'emulator-5554' "
C:\Users\athir>flutter doctor -v
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.19043.928], locale en-
US)
• Flutter version 2.2.1 at C:\flutter
• Framework revision 02c026b03c (2 weeks ago), 2021-05-27 12:24:44 -0700
• Engine revision 0fdb562ac8
• Dart version 2.13.1
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at \Users\athir\AppData\Local\Android\Sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio
• 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
• android-studio-dir = C:\Program Files\Android\Android Studio
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[√] Connected device (3 available)
• sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30)
(emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.101
• Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.41
• No issues found!
enter image description here
I had a similar error just recently. My own exact error was "No devices found with name or id matching 0DE9E241-5554-4D27-BAE5-7839B1FB1206". For anyone who faces such an error, I realized it was due to a folder that I guess was generated by vscode. A folder called .vscode in the project folder, inside that folder includes a launch.json file. In there you'll find a "configurations" key that houses an array of objects, check for the key "deviceId" and its value in the array, if that value matches the id you got in your error, comment out the whole code in that file and try running your app again. That worked for me.
Had a similar problem after updating iOS physical device.
Updating MacOS and XCode solved the problem
I was having the same issue, I have resolved it just by downloading the developer profile for the iOS device on which I was trying to build the application.
Steps -
1- Check your iOS device version
2- Go to - https://github.com/iGhibli/iOS-DeviceSupport/tree/master/DeviceSupport
3- Download the developer profile according to your iOS OS Version.
4- Unzip the downloaded file and paste the folder into /Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
To achieve the 4th step,
Goto Applications -> Right Click Xcode -> Click on Show Package Contents
Now follow - /Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
5- Restart your Xcode
Cheers, all set.

Flutter app starts in an unusual way after reopening

I would be sounding silly but it is a real problem with me. I started flutter about a month ago and whenever I upload my app on my android device , I have never run it on an emulator ,it seems to remember its state not that state management one. I will explain what I mean.
Suppose I have my flutter with a text and appbar. So I run my app on my device It runs perfectly. Then I added a floating action button and I hot reloaded my app all is fine the floating action button is in my app. So I closed my pc and then I wanted to look at my app again So I opened it from my phone and the floating action button is gone only text and appbar.
I even uninstalled my app and reinstalled it using flutter run but there is still that problem.
Here is the output of flutter doctor
[√] Flutter (Channel beta, 1.19.0-4.1.pre, on Microsoft Windows [Version 6.3.9600], locale en-IN)
• Flutter version 1.19.0-4.1.pre at C:\flutt\flutter
• Framework revision f994b76974 (6 days ago), 2020-06-09 15:53:13 -0700
• Engine revision 9a28c3bcf4
• Dart version 2.9.0 (build 2.9.0-14.1.beta)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\Anupam Karn\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio2\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 Studio2
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code
• VS Code at C:\Users\Anupam Karn\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.11.0
[√] Connected device (3 available)
• SM G600FY • cc07c483 • android-arm • Android 6.0.1 (API 23)
• Web Server • web-server • web-javascript • Flutter Tools
• Chrome • chrome • web-javascript • Google Chrome 83.0.4103.97
• No issues found!
Please help me sort out this issue it happens with every app I make
When you hot reload, no new apk is generated. The source code from the changed files is compiled into kernel files and sent to the mobile device’s Dart VM. The installed apk is untouched.
Read more here:
https://flutter.dev/docs/development/tools/hot-reload
So if you change something, hot reload, close the app and reopen the app it will be the old app again. If you only do flutter run (without build), you install the same old apk again. You need to run flutter build first to have an updated apk.

Flutter run show previous debugprint?

when i'm running flutter run again it will show previous debug print idk why?
can i fix it?
i want to make print clear for new run
even if i unplug my device it still print previous print
also i already did flutter clean and invalidate cache / restart
this is flutter doctor -v
flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.17134.1184], locale en-ID)
• Flutter version 1.12.13+hotfix.5 at C:\datac\flutter
• Framework revision 27321ebbad (3 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\Ethel\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 40.2.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] Connected device (1 available)
• Redmi 4A • 7effb4f17ce4 • android-arm64 • Android 7.1.2 (API 25)
• No issues found!
This does not affect the functionality of the app you are building. It has to do with flutter hot reload feature. If you do a cold PC reboot and do flutter run, after the build process is completed and the app gets installed on your device, you can notice a spinner in your IDE saying "Syncing files to device deviceName..." (This happens once). This process moves files to your device memory which helps in hot-reload. To clear the log, you need to delete those files. And easy but not necessarily a fast way to clear the debugprint will be to:
Reboot your android device or emulator This will clear the memory
or
Use another android device/emulator for testing

Flutter SDK is not authorized by AVD

I'm running Android studio as an administrator in Windows 10. The AVD is a Nexus 5X API 28. I'm trying to run the flutter demo, but the device drop-box still shows "no devices", it only has the "Open Android Emulator" option, which I clicked to start the AVD:
The output of
flutter doctor -v
is:
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17134.407], locale en-US)
• Flutter version 1.0.0 at C:\Users\User\flutter_windows_v1.0.0-stable\flutter
• Framework revision 5391447fae (10 days ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at C:\Users\User\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[√] Android Studio (version 3.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 31.1.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[!] 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.
Unlike in a real phone connected via USB, here there is no authorization dialog when I start the AVD. How can I authorize the phone?
This simple solution worked: Wipe data and Cold Boot.
Didn't work:
Note that in the Terminal of the Android studio, adb is not recognized (following flutter installation instructions). You can add the android SDK location path to the PATH environmental variable just to be able to run adb, but this won't give you more information than flutter doctor -v. The android SDK path should be already in Tools|SDK Manager, which is in my case "C:\Users\User\AppData\Local\Android\Sdk", nothing to do with "android-sdk-windows". Killing and restarting adb didn't work.
Logcat shows the message "Please configure Android SDK" (click on "configure", opens "Project Structure" window). The paths to SDK and default JDK are valid. Installing NDK miscofigured something else, so I uninstalled it and left this path field empty. Under "Project", all Version and Repository fields are empty.
You should add ANDROID_HOME variable to your class_path
set ANDROID_HOME=C:\<installation location>\android-sdk-windows
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
Taken from this
After that call flutter doctor -v and flutter devices