Flutter run show previous debugprint? - flutter

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

Related

Flutter on-screen keyboard not showing characters

As of recently I started receiving a broken on-screen keyboard when running (or debugging) my Flutter app.
See the attached screenshot from running a form validation demo from https://flutter.dev/docs/cookbook/forms/validation.
The keyboard actually accepts keypresses. Wierd thing is that switching to uppercase makes the keyboard show the (uppercase) characters. Should I uninstall/install the stack again or are some other measures appropriate?
PS C:\Users\Pavel\testform> flutter doctor -v
[√] Flutter (Channel stable, 1.20.3, on Microsoft Windows [Version 10.0.18362.1016], locale et-EE)
• Flutter version 1.20.3 at c:\flutter
• Framework revision 216dee60c0 (8 days ago), 2020-09-01 12:24:47 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\Pavel\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• 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)
[√] VS Code (version 1.48.2)
• VS Code at C:\Users\Pavel\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.14.1
[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
Go to android studio -> avd manager -> your emulator -> wipe data and try again. If not resolved, delete the emulator and create a new one.
Try to cold-boot the emulator. This works for me!

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

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.

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.

App keeps crashing after recent upgrade to new versions of Flutter( v1.12.13+hotfix.8) and other libraries

App is crashing with following error message in some devices. Its not happening in all devices.
Fatal Exception: java.lang.UnsupportedOperationException
The new embedding does not support the old FlutterView.
io.flutter.embedding.engine.plugins.shim.ShimRegistrar.view (ShimRegistrar.java:82)
io.flutter.plugins.camera.CameraPlugin.registerWith (CameraPlugin.java:54)
io.flutter.plugins.GeneratedPluginRegistrant.registerWith (GeneratedPluginRegistrant.java:47)
com.pickcel.taskmanagement.Application.registerWith (Application.java:22)
com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask.startBackgroundIsolate (HeadlessTask.java:186)
com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask.dispatch (HeadlessTask.java:94)
com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask.run (HeadlessTask.java:88)
Device list :
Xiaomi (Note 7 pro, poco f1, etc)
Samsung (Galaxy M30, S10, A50)
HMD Global (Nokia 4.2, 2.2),
** Mostly with Android OS - PIE(9)
It caused 6K+ crashes till now. I have check the project and i'm not using ShimRegistrar anywhere.
I was also receiving this very same (annoying) errors and also using the background_fetch plugin. Once my app was terminated it wasn't possible to make the background_fetch wake it up without trapping into a FATAL error.
It happens that this plugin was recently updated to a new V2 plugin API standard and it requires that many small changes are made in the "Android side" of your Flutter project.
I strongly recommend that you follow these instructions:
https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
After that please compare your AndroidManifest.xml, Application.java, MainActivity.java and styles.xml files with the ones available at:
https://github.com/transistorsoft/flutter_background_fetch/tree/master/example/android/app/src/main
My Flutter Doctor results in case you want to compare with yours.
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale en-US)
• Flutter version 1.12.13+hotfix.8 at D:\Tools\flutter
• Framework revision 0b8abb4724 (5 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at D:\Android\android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Android\android-sdk
• ANDROID_SDK_ROOT = C:\Android\android-sdk
• 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 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code, 32-bit edition
• VS Code at C:\Program Files (x86)\Microsoft VS Code
• Flutter extension version 3.8.1
[√] VS Code, 64-bit edition (version 1.43.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.8.1

Flutter for web, print function is not working with VS Code on windows

I used flutter run -d chrome to run the app, but dart's print doesn't work properly with VS Code in windows. I looked for solutions from another issue, but the problem still exists.
But, it will work fine on android debug.
$ flutter doctor -v
[√] Flutter (Channel master, v1.13.6-pre.25, on Microsoft Windows [Version 10.0.18363.535], locale zh-CN)
• Flutter version 1.13.6-pre.25 at D:\flutter_sdk
• Framework revision b7af5e714d (6 hours ago), 2019-12-25 23:49:55 -0800
• Engine revision 33813929e3
• Dart version 2.8.0 (build 2.8.0-dev.0.0 886615d0f9)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at D:\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 28.0.3
• ANDROID_HOME = D:\Sdk
• ANDROID_SDK_ROOT = D:\Sdk\
• 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.
[√] Chrome - develop for the web
• Chrome at C:\Users\jeff\AppData\Local\Google\Chrome\Application\chrome.exe
[!] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] Connected device (2 available)
• Chrome • chrome • web-javascript • Google Chrome 78.0.3904.87
• Web Server • web-server • web-javascript • Flutter Tools
! Doctor found issues in 1 category.```
desc:#47820
Check whether something accidently typed on filter box of DEBUG CONSOLE in VS Code. A single letter can block entire print outputs.
(know this is an old question, but hope somebody will benifit from it someday)