Tools seems to lag behind Android emulator - android

Ever since updating to the latest ADT (version 18), I've noticed that there seems to be some sort of odd lag between what's happening on device emulators and what various tools are seeing. For instance, if I set a breakpoint in Eclipse and then attach the debugger to a running app, the debugger will miss the first time that the breakpoint is reached, breaking only on subsequent executions. Similarly, if I try to take a screen snapshot with the Devices view, the image is always from one or two screen changes back. Similar behavior happens if I run hierarchyviewer outside of Eclipse, so I don't think it's an Eclipse problem specifically.
I should mention that the part of the app that I've tested this with has static screens that change only on user input (that is, no animations or background threads); so it's not just a communication lag. I can change screens, wait five minutes, take a screen snapshot, and still get an image of what had previously been on the screen. Screen snapshots in perticular never seem to catch up. (Repeating the snapshot still generates the previous screen, not the one on display.)
Has anyone else seen this behavior? Does anyone know how to fix it?
UPDATE: This is on a Windows 7 machine running Java 1.6.0_26 and Eclipse 3.7 (Indigo).

The Google/Android team have been enhancing the emulator images with the ADT updates like GPU support and sensor injection. If you are using old emulator builds (AVDs) from when you first created your work environment (say months ago) you will want to recreate them fresh from the new tools and see if the problem resolves.

Related

libGDX starts failing to tick breakpoints after just a few hours of working with Android device

While researching this I was writing an answer to IntelliJ IDEA: Breakpoint not being hit, and is shown without the tick, just a red dot until I realised it is a completely different question. I have had this issue twice in the past 4 weeks, but my use-case is IntelliJ is no longer ticking the red breakpoints. I just watched the ticks fall away before my eyes.
First time it occurred was after unceremoniously ripping out the USB cable in a hurry. I don't appreciate the need for ceremony here. That broken project remains so.
I tried everything to fix it, and gave up on that particular project; it was largely complete. I tried adb kill-server and the general family of off-then-on-again solutions to no avail.
Fast forward a couple of weeks I'd forgotten about it and was delighted (I tell a lie, I was taking it for granted) to be able to test my new protocol with breakpoints on an Android device. First symptom was my icons messing up (I thought I must have had a trapped thread somewhere in the IDE but find it hard to believe I wouldn't have noticed that with just the single process being debugged). Next the breakpoint's tick just dissappeared and I had a blue message in the IDE's console, something about GDX and taking too long with the graphics (similar message appended at bottom of post). Foolishly I restarted the apk.
What haven't I tried? I'm thinking something drastic like persevering with Desktop only development, or ditching Windows. I thought about upgrading (contracting) Gradle but my other project was brand spanking new and recently diagnosed with specific Gradle version dependencies.
I can start the app from my dev machine but even pausing isn't able to find what it is doing because it will pick a (random) thread out of context with my app.
I can also hit breakpoints from the Desktop app
I suppose I should try Android Studio with this project but know that won't be an easy fix. I'm using Win10 Pro and on brand laptop and phone (nothing fancy mind). I'm using Gradle 2.1 (IIRC, I get a daily nag to upgrade to 4.1) but my other similarly fated project has specific dependencies on Gradle versions so I want to leave well enough alone.
I don't know if it's the answer or not, but it seems to work fine with the emulator, which would seem a more universal solution than something as challenging as, you know, supporting a bunch of different hardware. I ran it again and trapped a certain line, observed the same screen artifacts as before, but killed it before I could lose my emulator too.
This is the last thing she printed:
W/zygote: Long monitor contention with owner GLThread 260 (8155) at boolean com.mygame.game.screens.Menu$4.keyDown(int)(Menu.java:128) waiters=0 in boolean com.badlogic.gdx.backends.android.AndroidInput.onKey(android.view.View, int, android.view.KeyEvent) for 9.799s
It was trapped in a different method but the gist of it is I've blocked the GLThread.

Android Studio 1.5 not rendering layout preview

So I'm staring at this image trying to figure out how to actually look at my app...
I just updated my IDE to 1.5 and now none of my projects render a visual representation of their layouts.
I've tried restarting the application, checking for updates, restarting my computer, making sure my SDKs are all in order, but without fail upon startup I am treated to a pleasant view of nothing.
I've tried the solutions listed here and here but nothing has really worked. I don't see a sort of rendering log or even alerts of bugs.
Any ideas?
I had to re-install pretty much all of my SDKs, but I was finally able to get the layout to render again.

Android Studio screen tearing on dual monitors

I recently installed Android Studio to learn more about app development. However, I'm seeing screen tearing to such an extent that the IDE is pretty much unusable. Demonstration in the photos below:
Example showing a typical screen tear
Example showing NO tearing (same project, same editor view - captured by minimising the window, re-maximising it, then quickly taking the pic)
For the avoidance of doubt, this screen tearing is only happening within Android Studio on my Windows 10 machine. No screen tearing happens within games, editors such as Notepad++, or suchlike.
Some of the things I've tried to pinpoint the issue:
Changing my graphics card settings, back when I didn't know it was limited to Android Studio. I have a GeForce GTX 980, and various googling led me to tweaking VSync to adaptive and Triple Buffering to On in the hope it resolved the issue. I also tried changing my two identical monitors' refresh rate (connected via Display Port cables, Extended desktops) from 60hz to 59 and 50 to see if it might resolve it. No luck.
Changing many of the Android Studio appearance settings e.g. turning window animations on or off, changing the tooltip MS delay timer, turning off file synchronization/file saving on frame activation and background saving entirely, etc.
Even changing the Android Studio config e.g. -Xmx2048m instead of the default 750mb.
In terms of triggers, the issue is intermittent, but when it does start, it's there until I reboot my machine. In other words, it doesn't relate to my running a phone emulation or having a specific phone emulated, nor what other programs are running on my machine at the same time, nor if the phone "preview" screen is showing, nor if a gradle build is running in the background, etc.
Other interesting aspects that I've spotted are:
The screen tearing seems to be concentrated around where the mouse cursor or keyboard input is located, not randomly on the screen.
I think the issue is not occurring when my monitors are set to Duplicate their displays, rather than Extend. I'm not 100% sure on this yet though; I certainly haven't seen it in half hour experiment using the Duplicated monitors.
I'm now out of ideas, and ready to give up on Android Studio.
Although this feels more likely to be a hardware or graphics issue, because Android Studio is the first and only thing that I've experienced issues with, I was hoping someone else may have an answer about what else to try.
I was having this issue as well on Android Studio 2.0. I fixed by disabling G-Sync on my Nvidia GTX980
See Android Issue Tracker http://code.google.com/p/android/issues/detail?id=189308 ("Screen garbled / messed up when repaint on 1.4").

Is it just me...or is android honeycomb 3.0 emulator really slow?

Well? I've tried increasing the RAM size of the emulator to 1024 MB and there was little improvement on the speed, however, it's still unusable. It has the speed of a turtle.
Anyone got better ideas to make it faster? Is there something I'm not doing correctly?
Check out the android developer documentation regarding 3.0 emulator performance. Scroll down to About Emulator Performance.
Copied tip for convenience:
Tip: To improve the startup time for the emulator, enable snapshots for the AVD when you create it with the SDK and AVD Manager (there's a checkbox in the AVD creator to Enable snapshots). Then, start the AVD from the AVD manager and check Launch from snapshot and Save to snapshot. This way, when you close the emulator, a snapshot of the AVD state is saved and used to quickly relaunch the AVD next time. However, when you choose to save a snapshot, the emulator will be slow to close, so you might want to disable Save to snapshot after you've acquired an initial snapshot (after you close the AVD for the first time).
Seems like everything 3.0 and beyond is slow for me. Everything before that runs very fast in emulator for me. However, I have an Intel integrated graphics card in my laptop. When I turn 3D setting to "Application Settings," I get relatively decent performance from the emulator, at least when it starts up, but then when I try to start any app from the default main app menu (contacts, for example) I get launcher errors. That happens for me on 3.0, 3.1 and 3.2. The one thing I'm suspicious of is that I'm running 64-bit Java SDK. Seem to be a number of posts out there related to 64-bit, but mostly they seem to be point to using 64-bit SDK with 32-bit Eclipse or vice versa, but in my tests, I am not even running Eclipse, haven't even reinstalled the ADT yet, just the Android SDK and created a few emulator instances. Again, prior to 3.0 everything is fast. 3.0 and beyond not good, but A LOT better with graphics settings as I mentioned above. If I could get past the launcher issues, I think I might be all set. Oh, btw also, for 3.0 and beyond, I bumped the memory up to 1024. I've tried increasing the heap for apps to double the default (from 48 to 96) but that doesn't seem to have alleviated my launcher problems.
It is slow. You can try creating a new Emulator with a smaller resolution.
I remember someone at google I/O saying that the HoneyComb emulator will run really really slow due to hardware acceleration turned on.
The PC may use software rendering for OpenGL hence the bad performance. The almost everything you see on the HoneyComb screen is rendered using OpenGL ES.
감사합니다,
Reno

Android Emulator is crashing a lot

I am trying to test my app on android emulator. So as soon as, i am choosing run the application, a new window pops up on the screen and after taking 1-2 minutes, it goes not responding.
I also tried running the emulator separately using AVD manager. Using this, i am able to start the emulator; but after 3-4 minutes - it goes "not responding".
OS- Windows 7 32 bit [ intel pentium 3.00 GHZ + 2GB RAM]
Java - 1.6
Android SDK - i have the latest SDK with 3.0 OS
IDE - eclipse Helios Service Release 2.
Plz help, i am unable to do anything.
Update: can you guys point me towards other 3rd party emulators which i can use?
Update2: My emulator is taking too much time in launching now. Can this be a cause? If yes, then how do i decrease the boot time?
(This isn't so much of an answer, but might go some way to figuring out the source of the problem; I'd comment on the original question instead but don't have enough rep to do so)
I keep having this problem too. I have an app with a few activities, one of which contains a layout with a Canvas which runs its own thread to do drawing processing. All of the activities run fine except for this Canvas activity which seems to crash the emulator in the way the OP described (the emulator .exe itself crashes rather than the application within the emulator) if left to run for a few minutes. As far as I can tell I'm not doing anything unusual with the thread - I copied the Lunar Landar example in the SDK and worked from that so I'm doing everything "by the book". The app runs fine on real devices.
So, while I realise the OP may be long gone, could anyone else with a similar problem confirm that the affected Activity is using a Canvas, drawing Thread, or anything like that? This problem is a real pain and I can't find any other discussions/solutions for the matter.
EDIT: I recently did a complete, clean re-install of the most recent versions of Eclipse and the Android SDK with all the updates and that seemed to solve the problem. Guess there was a bug in an older version of the emulator that was fixed in a more recent release.
Have you enabled snapshots. If you enabled it then you can be trying to open a incorrectly saved snapshot. If so, while starting the emulator with launch options, uncheck launch from startup
#mudit:remember Android 3.0(Honeycomb) is dedicated entirely to only tablets and not the mobile phones..
Does the emulator prompts you "not responding" in your app or when you just start the emulator without launching an app, too?
A strong advice: you don't need to restart the emulator for every app launch, just keep him running (maybe you already do that).
Does the logcat show some errors prior to the "not responding"? Have you tried creating another AVD?

Categories

Resources