Flutter problem: Lost connection to device. Plugin implementation? - android

I cannot solve this error. The app seems to build just fine but, for some reason, can't seem to connect to the emulator. It always ends with "Lost connection to device" while installing. I also tried it on a physical device, still won't work. I have tried numerous possible solution, but none of them worked.
What I've checked:
Memory enough
No connection problem
flutter doctor -v shows no issues
The problem might be some plugin issue, but I don't know what or how to solve it. It also might be something else. If further code or information is required do let me know. Does anyone know how to solve this issue?

I have two times facing this issue, to fix it sometime it is a bit tricky.
It is coming from 2 possibilities:
Device you are using
Invalid SDK after accidentally updates its version.
But, if the problem is on your device, try this.
Reset the debug authorization on your device
Go to settings > developer options > revoke USB debbuging authorization.
If problem persist.
Check the disable adb auth timeout if it unchecked.
Modify the Logger buffer size to max (Mine is set off before, now it is 8MB, and changing this to 64k is working on small apps, but bigger apps need to log the debug process much bigger so it needs to increase its capacity).
Hope this can helps you mate!

What usually fixes it for me is to close the emulator, go into Android Studio Device Manager and 'Wipe Data' for that emulator. See image:

Related

Android app slow when installed from Android Studio, but runs fine when installed from adb

I'm not really sure how to word this.For some reason when I install an app that I'm working on from Android Studio it runs very slow (when an option is pressed it takes 10-20 seconds to register). But if I install the app from either my coworkers Android studio or adb from my own machine it works fine.
My specs are:
OS: Windows 10
Android Studio Version: 3.0.1
Phone OS: Android API 24
It was working fine this morning, but during the course of the day, something has happened. Has anyone run into this sort of problem before?
I'm using a Samsung Galaxy S8 physical device. I have tried a factory reset on the phone which worked for one install after I changed some things I'm back where I started. I have also restarted both the machine and phone multiple times. I'm at a loss as to what is going on. If you guys need any more info let me know. Also INSTANT RUN IS NOT ON.
EDIT: I'm at a total loss as to why this is happening. I've tried everything from restoring the phone, reinstalling Android Studio, changing wires, changing settings, but nothing is working. If anyone has a suggestion I will gladly try anything.
I've finally found a solid solution to my problem. I'm positive now that something went wrong with m usb drivers for windows 10. I went to this page https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware/windows-10-slow-usb-30-transfer-speeds/a5e1eebb-74bb-4777-8902-5131f3e8ec3e and I completed the steps in method 1 and that did the trick for me. it took a while to find this out, but hopefully, someone else will find this helpful.
Have you compared your yesterday build and today build which is making your app slow. Any Significant change in code?
Have you set up breakpoints or similar? Some debugging options can significantly slow the app down at runtime. When this happens, if you disconnect the phone from ADB - e.g. pull out the cable - and it speeds up again, then it's likely related to your debug connection to that particular instance of Android Studio.

Android not allowing manual apk install

My device is no longer allowing me to install apk files manually. The install screen shows up like normal, only it will not allow me to click the install button. I am allowed to click the cancel button, so the screen is still responsive and not lagging or frozen, but there are no error messages or any kind of UI element telling me what the problem is.
I've previously installed apps this way and I can't think of any settings I've changed since, especially not the kind that would break this. Any advice would be greatly appreciated!
Running Cyanogenmod 10.2/Android 4.3.1 (Jellybean), install from unknown sources is checked. Screenshot below:
Try these steps:
1). Goto the package installer app and clear data and then try to install the app.
2). Boot to recovery, wipe cache and dalvik cache, reboot and then try to install.
If you are able to install from playstore then this should fix your problem. I hope it helps.
So I finally figured this out. I was searching around and found someone with the same problem here. Their problem was Talkback, but I started experimenting with closing my running apps and Twilight turned out to be the culprit. Not sure what Twilight had to do with this...but can now install from unknown sources again.
NB: It's enough just to pause Twilight, you don't need to uninstall/disable/clear cache or even force stop it.

Selected Device Incompatible - Android Studio

I have fixed this problem before but I can't now and I need a permanent fix. Everything has been going fine in Android Studio when it comes to testing my app. I now run into the problem "The selected device is incompatible." when I go to run the app. I'd like to know how I can keep it from reading my phone's API as 1 rather than changing my minSDK to cater to this problem, if possible.
EDIT: Literally just found a fix, not sure if it is permanent. I just restored my defaults in Development Options, turned USB Debugging off and on again and that did the trick.
All I had to do was turn off USB debugging, then turn it back on and it worked immediately. I didn't have to reboot or change any other settings.
Not sure if this helps. I had a similar issue using my MotoG 2nd generation with Android Studio on Ubuntu. I switched the settings as how my phone was connected from MTP to PTP. That worked for me.
I had a very similar issue,
Usually whenever I connect the android device for usb debugging, the device will prompt me asking for the permission from to access from the development PC
In my case, for some reason, I didnt get this prompt and hence, I got this error. I have turned off developer options & USB debugging, turned on again. Then, I got the prompt and the issue is solved

Eclipse won't recognize G-tablet

I am trying to view a sample app on a real device (a ViewSonic G-tablet), but the device won't display in the "Choose a running Android device" area. The virtual devices show, but no real devices show (there is only one plugged in, the G-tablet). Some other information...
I am using a Mac with Eclipse SDK 3.7.1 w/Android
App is noted as debuggable in manifest file (android:debuggable="true")
G-Tablet is set to allow debugging
Device selection is set to manual in SDK
I CAN view files on G-Tablet using Finder
I have reviewed Android developer docs
I have searched a lot online for a fix, without success
Please also note...
There is NO option on G-tablet to allow "unknown sources". However, I have downloaded apps outside the customary channels (e.g. Firefox from the Firefox site) and it works fine.
I do NOT want to do anything to the G-tablet to void the warranty.
I have already checked for/installed updates using the Android SDK Manager.
The fixes I was able to find on StackOverflow related to this problem did not work for me. I am thinking the problem may be device specific. One fix discussed getting a driver for the device, but I couldn't find one.
Can anyone please help me figure out how to get the SDK to recognize my device? I'd appreciate any insight on this.
Can you export the app as an .apk and run that on your G-tablet?
also is the android:minSdkVersion set to a value lower than your G-tablet's version?
Found the answer after trying a zillion things. All that needed to be done to fix the problem was turn to OFF 'USB debugging' and then turn it right back on. I found the idea on this page... http://www.mobileread.mobi/forums/showthread.php?t=156247 . Hope that might save someone else hours of time.

Overpopulating Logcat causes Windows to freeze, until a hard reboot is performed

The title speaks for itself, but I would add some pointers I've noticed along the way.
I would like anyone who also experiences the end result while developing for Android to try to reproduce this and see if this scenario is really the case.
The crash happens when Logcat is overpopulated. By overpopulated I mean that from a point in time, if you would leave a device connected in debug mode for a while, and you would look at the Logcat view, it would display only the new 'delta' lines added to the log in the past short interval of about two seconds.
If you would pay attention, while the Logcat is overpopulated, the device which is been debugged, responds slowly to user interaction (this can be your indication, that the Logcat is overpopulated while testing your application), and perform other actions ridiculously slow.
If you would leave the device connected and more logs would be added, there is a short interval 5-10 seconds, where Eclipse starts to behave weird, and after that, there is nothing you can do, Windows 7 freezes and only hard reboot allows you to get back to work.
I can reproduce this every time, if I would just leave a device connected in debug mode with an application running.
I've Googled this and came up with nothing. I assume that if me and my colleagues encounter this (we have the same Eclipse setup), then other should also experience this, so before posting a bug, I would like to confirm this...
Details:
Windows 7
Eclipse 3.6
ADT 10.0.0.v201102162101-104271 (latest for today)
I have the same problem here. I've been troubleshooting this for months! Mostly because it's been extremely difficult to find anyone with the same issue. (I was actually linked to this post from the bug report that Android Developer provided.)
I've been working with someone on a similar Stack Overflow issue. He thought the problem was his IDE until I reported that I was experiencing the same issue, but with a different IDE. Together, we've been able to whittle the problem down to either the device itself or the drivers. We recently just excluded the USB cables as the culprit.
However, the problems reported in the Google bug report are exactly what we've been experiencing. It makes sense that ADB might be where the problem ultimately lies.
Hopefully, this post will help create some search-friendly connections between the other posts.
Other Stack Overflow post mentioned above -- Android development in IntelliJ IDEA causes computer to freeze
Google bug report, Issue #24171 (originally posted by Android Developer) -- http://code.google.com/p/android/issues/detail?id=24171
I also have a similar problem. Sometimes, the Windows OS completely freeze when an Android device is connected.
I'm not sure why it happens, but I think that it only occurs when the ADB is active.
Here's a bug report I've found recently about this:
adb causes whole Windows operating system to freeze randomly
After using a USB from the back, and installing Windows 8, the problem doesn't occur any more.
However, it's Windows 8, and I wish I used Windows 7. For some reason, Microsoft didn't provide a way to go back...
Try setting your Eclipse Android Settings for the maximum amount of logcat messages in the buffer to a lower value.
This should help
I don't want to jump to conclusions, but I think I've found the real issue which causes this halt...
I'm going to make some assumptions, and if one of these does not fit your scenario, let me know:
Assumptions:
This only happens on a chargeable computer... Be very very sure before dismissing this assumption.
This happens when a laptop is connected to the adapter, and is being charged.
Cause:
This happens when you use a custom adapter, and not one that 100% fit your computer.
According to my experience, once I've used my home adapter on my work computer, the crash reoccurred over, and over, and over... drove me nuts... and when I got back to work, and used the proper adapter, the issue vanished!
Same with my home computer, and work adapter.
Lend me your thoughts...

Categories

Resources