Android app not running on the emulator - android

The emulator won't launch my apps even on a real device! I've tried every solution online, even reinstalling android sdk,ADT plugin. The app run SOMTIMES(4x to be exact) though, like awhile ago, when i got home i tried it again, and it run on my first try then i began working on the code again then i tried to run it, won't run again. Even basic apps like hello world won't run most of the time. I've set the run configuration to let me choose my device everytime, but even the device chooser wont show up(showed up once only), i tried waiting for 30 minutes(also tried the kill-server start-server) but it just wont run! my real device, or the emulator is listed on the DDMS perspective and there's nothing on console. please help, cause I've wasted 2 days for this already.

Have you also tried, taking the USB cable then disabling debugging and then enabling debugging and putting the USB cable back.
I remember this happen to me, so I did what I mentioned and surprisingly it works. Hope it work for you too.

Maybe you should try deleting your emulator and creating a new one. Make sure that all your settings are correct and that you are targeting the right OS version.
I've had quite a few problems with the emulator and wiping them and starting from scratch worked more often than not.
As for the real device, the first real hurdle is getting the right drivers so that your PC can recognize it, after that kill-server start-server usually does it. I'm surprise that didn't work for you.

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 debugger continually disconnects

I have never had an issue debugging in Android until I switched to my current workspace. It happens in both Eclipse and IntelliJ. Previously I had an issue where the phone would hang at the "Waiting to attach debugger" dialog. Somehow I fixed that so the debugger at least attaches to my app.
Now I can set a breakpoint and have the debugger stop at that point. After about 5-10 seconds it disconnects no matter what I do. I'm able to read a few values of variables in memory before everything disappears. My co-worker is able to debug the same app just fine using Eclipse and we haven't been able to figure out what is wrong or different between our workstations (besides me using IntelliJ). We might have different images for our laptops though.
Any ideas? I've had to use Log statements for now but they are just too slow compared to using an actual debugger. I've tried using different USB cables and that didn't make much of a difference. I've gone through the debugger settings and nothing seemed out of the ordinary. Other Q/A's on SO have mentioned the app silently crashing, but I'm ruling that out due to it debugging fine for my co-worker.
I've been having the same problem running IntelliJ IDEA build IC-133.193. I solved the problem with the following actions:
Quit IntelliJ
From a command line kill the adb server with adb kill-server
From a command start the adb server as superuser with sudo adb start-server
Restart IntelliJ
IntelliJ will start the adb server if it detects that it is not running. The key appears to be starting adb as superuser before starting IntelliJ.
[Update] This doesn't always work. The best solution I've found is to start the app on the device and then attach the debugger to the Android process through the Run menu. I haven't had any disconnections using this method.
I have been fighting for a few days with adb not seeing my device. After trying many other posted solutions, I discovered that the issue was with Chrome also trying to connect its debugger to a web view. If Chrome is connected using chrome://inspect, then adb seems to disconnect. Quitting Chrome resolves the issue. Then I can connect with Android Studio and then restart Chrome and reconnect. Hope this helps someone else.
This fixed it for me
Go to Power Options on your computer
Click 'Change plan setting' on your chosen plan.
Click 'Change advanced power setting' on your chosen plan.
Expand 'USB Settings' .
Expand 'USB selective suspend setting' and change it to disabled.
This issue occurs to me when I try to use a USB 3.0 port. Using a USB 2.0 it does not happen.
This happens to me when the cable connection is sensitive.

Android device keeps disconnecting from adb / eclipse

So I've read nearly every stack overflow answer about this issue, but still no solution. My device keeps getting disconnected. I've switched through 12 wires, I've tried every USB port; nothing. Eclipse keeps dropping the connection. It happens most often when I enter debug mode. Has anyone found a solution to this? Is this a bug in the new update? Seriously, this makes debugging and testing so painful. It slows down my testing by at least 3 times. There has to be a better solution.
First thing I tend to try is the following commands in cmd/terminal
adb kill-server
adb start-server
And lastly,
adb devices
To check the device is connected.
Following that I'd try restarting the device, and perhaps as a last resort uninstall/reinstall it's drivers.
Edit: also, do you have access to another device? In the past I've had issues with specific devices constantly dropping out.
I experience that when my nexus7 2012 kept disconnecting; root cause was the USB3 connection.
Changing to a USB2 port fixed my issues; can you try switching to a lower speed port?
I was having a very similar problem but using Android Studio on OS X. By default Android Studio points to an SDK inside it's application bundle so I changed the SDK location setting to point to another version of the Android SDK I had downloaded manually and this seems to have fixed the disconnection issues I was having.
Instructions for changing the SDK location setting can be found in this answer.
My connected device (an Acer) was working a treat until I rebooted my mac. After the reboot, Eclipse dropped the connection every single time I ran the app. I tried two cables and every port in my iMac but nothing worked. I had to disconnect and reconnect the device for every run (a real pain when debugging!).
What worked for me was to run the app. When the window appeared to choose the device to run on (which was empty), I disconnected then reconnected the device, but before clicking to run, I checked the box (bottom left) to use this device for each run. It now runs every time directly on the device.
a unpowered usb hub did fix the problem for me. it was happening on both my samsung s6 and my sony z5 premium.and both on my pc and my mac. (using android studio).
Use short usb cable. The shorter the length of cable, the more stable the adb connection. I had the same problem for long time. I changed the cable to shorter one and I haven't got that problem anymore.

Having a problem loading the Android Emulator in Eclipse. All it says is ANDROID_. Any suggestions?

I went through the simple hello world application on the android developers forums to an absolute T. But, when I start the emulator all it comes up with is a large black screen that just says ANDROID_. The '_' is flashing. Does anyone know what may have caused this or why it is not working.
It can take a while to start. Remember it is emulating an ARM processor so that can take a while depending on the specs of your machine. Start it and give it 5 min. If it hasn't come up by then you may want to close and restart. While it is starting up, if you open ddms you can follow what is going on in logcat.
Good news is that if you enable snapshots, once you get it started and saved (it does this on its own). Subsequent starts should be pretty quick.
For some reasons, the android emulator does not work properly on any of the laptop's i have. It lags even on my high end laptop with 4 gb Ram, i5 processor and 1 gig graphics processor, so i connect my phone using usb cable, enable debugging mode and run the app on the phone from eclipse. You will need a working adb connection as stated on android developer website though. It works pretty good and is way better than using an emulator. :)
It takes about 3 mins for the emulator to load on a laptop. Wait for about 5-6 mins if not. close it.
In case when you restart still you get the same, go to AVD Manager delete the image and create a new one.
As the others have said, the emulator is very, very slow to start up. It can get wedged on startup for me, every now and again, but shutting it down and trying a second time almost always works. And yes, you can leave it running the whole time, but note that Eclipse and/or ADB can get wedged as well. You'll see logcat stop updating inside of Eclipse. I can usually get it restarted by doing
adb kill-server
adb start-server
Sometimes, just doing an adb logcat on a command line will get things moving again. Good luck.

ECLIPSE ANDROID DEVICES DISAPPEAR

I have a problem with the Android emulator. After I run my application on a device it disappear from DDMS at some moment with no reason, even if it is still started. The only way to run again is to close the previous emulator and reopen it by running my application.
Do you have any solution for this strange error ? I must say that I can't deactivate my firewall if that is the problem. Also I tried to reset ADB but still doesn't work.
An answer for others that will come here looking for a solution.
You just need to restart ADB (kill-server and then start-server).
More details on how to do so: http://developmentality.wordpress.com/2010/09/13/android-disappearing-emulator-restart-adb-server/

Categories

Resources