Slashdot Mirror


Android Needs a Simulator, Not an Emulator

An anonymous reader writes Jake Wharton, Android Engineer at Square, has written an article about one of the big problems with building apps for Android: developers need a simulator for testing their software, rather than an emulator. He provides an interesting, technical explanation of the difference between them, and why the status quo is not working. Here are the basics of his article: "A simulator is a shim that sits between the Android operating system runtime and the computer's running operating system. It bridges the two into a single unit which behaves closely to how a real device or full emulator would at a fraction of the overhead. The most well known simulator to any Android developer is probably (and ironically) the one that iOS developers use from Apple. The iPhone and iPad simulators allow quick, easy, and lightweight execution of in-development apps. ... There always will be a need for a proper emulator for acceptance testing your application in an environment that behaves exactly like a device. For day-to-day development this is simply not needed. Developer productivity will rise dramatically and the simplicity through which testing can now be done will encourage their use and with any luck improve overall app quality. Android actually already has two simulators which are each powerful in different ways, but nowhere near powerful enough."

9 of 167 comments (clear)

  1. x86 Android Virtualisation: native performance! by thatkid_2002 · · Score: 5, Informative

    Android is available for x86 these days and you can use hardware acceleration (CPU and GPU). Just set it up and get near-native performance. Or if you have an Android phone just `adb install -r blah.apk` what more can you want?

    1. Re:x86 Android Virtualisation: native performance! by cerberusss · · Score: 4, Informative

      "Just set it up" isn't as easy as you make it out to be. I just tried it in Android Studio.

      First, you have to install a 3rd party kernel extension (from Intel). Then you have to configure an AVD with the new x86 value for the CPU/ABI field. It didn't appear for some reason for my target "Android 4.4.2". After looking around, I found another download in the Android SDK Manager called "Intel x86 Atom System Image", let's download that. The documentation mentions this, but I glossed over it. OK, back to the AVD manager and create a virtual device.

      Now I finish it, and run the app. Running the app takes 39 seconds, as Grails reports (about 5 seconds, if that, on Xcode for the iOS port of our project). It asks where I want to run it, pick the new AVD and click Run. It starts Android but not the app.

      Weird. OK, so I run it again with the simulator running. The option "choose a running device" cannot be selected. That's strange. I pick the new AVD again and unfortunately, it starts another copy. Shit. I let it boot but notice it's really slow as usual -- ten minutes later it's still booting. I check the already running copy and click around. Slow as hell as well. Apparently it's not accelerated at all!

      At this point, I'm ready to give up and go back to testing on a device again.

      The above is tested on a 2013 MacBook Air with 8 gigs of memory.

      --
      8 of 13 people found this answer helpful. Did you?
    2. Re:x86 Android Virtualisation: native performance! by The1stImmortal · · Score: 4, Informative

      How about Genymotion? http://www.genymotion.com/ - uses VirtualBox as the underlying x86 VM layer, instead of AVD + HAXM. Supports a few additional sensors too (either emulated or passed through from real hardware if it has them)

  2. Desktop integration by Anonymous Coward · · Score: 5, Insightful

    Given the open source nature of Android, what I don't understand is how no project so far has integrated the Android runtime with the Linux desktop. Licencing issues maybe? Leave it in a separate PPA.

    It would be amazing to be able to run Android applications in Linux seamlessly, ideally integrated with the indicators and notifications provided by the OS.

    That would be a killer feature (and would expand the library of games available for Linux by 1,000,000%), in addition to other applications.

    I know it is possible to emulate Android, there are some options for this, but it is not about emulating a phone in my computer; I already have a phone. What I would love is to run Android apps in it (of course, as long as that software includes x86 libraries, or there is an emulation layer available).

  3. I just use a real Android device by rklrkl · · Score: 4, Insightful

    Whilst playing around a little with Eclipse and the Android SDK, I found it much easier to just plug in my Android tablet (or it could be an Android phone or both) and download/run the app on that. You get to check rotation, multi-touch, camera etc. a lot more easily this way and it's just as easy (if not more so) than running the emulator. Of course, there could be Android devs without any Android devices at all, but I suspect that's a tiny minority.

    The main use of the emulator is probably just to test different screen dimensions render OK - I personally wouldn't use it during the bulk of development though.

    1. Re:I just use a real Android device by Threni · · Score: 5, Informative

      Yes. You can step through the code on your device from your pc. (Even if connected over wifi. Which is nice, when it works, but it's a little flakey. It's solid over USB though).

  4. Re:So much wrong by JaredOfEuropa · · Score: 4, Insightful

    Virtually nothing? I'd say that the simulator covers about 95% of my testing and diagnosis needs. I only have to resort to running on a physical device when I have to test stuff related to the on-board sensors, camera, or push notifications. So far I've found 1 case where the simulator did not behave as expected. If it works on the simulator, chances are it'll work on the device. If it doesn't work on the simulator, in almost all cases you will be able to use the simulator to diagnose and fix the issue. I should note that I do not do game development; I've no experience in writing apps with high performance 2d/3d graphics.

    With that said, I always test release candidates on various types of real devices.

    --
    If construction was anything like programming, an incorrectly fitted lock would bring down the entire building...
  5. Re:So much wrong by coinreturn · · Score: 4, Informative

    I should note that I do not do game development; I've no experience in writing apps with high performance 2d/3d graphics.

    Well, then, when you try doing those things you'll understand why my comment is true.

    Well, I won't. I have five games in the App Store and I have always used the simulator for development. It works very well. For me, it is VERY rare that something works on one while not working on the other.

  6. The resistance to this idea is surprising by iPaul · · Score: 4, Interesting

    As I read the comments I find it surprising that people somehow object to this idea because 1) they don't like the terminology, 2) the say the existing emulator is just fine, 3) Apple sucks, 4) If you just do these 37 steps, it works awesome on my machine and 5) did I mention Apple sucks?

    I don't program professionally but I am a tinkerer and I did try my hand at both iOS and Android development. As a noob in both, I found the Apple environment much easier in terms of usability. This is not a plug for Apple, but an observation about how fast the tool chain is able to launch the simulator and step into live, running code. There are obviously things that won't work, but I was able to get going quickly and play with the examples. It was also relatively painless (although there was a lot of hoop jumping) to get the code onto my phone and running.

    I like the Jet Brains based Android development environment. It's really nice to work it but when it comes to actually running the code you wrote, you basically need a real device. The emulator start up time is horrible and the performance while running is terrible. I've tried to get the x86 ABI running on my machine but I didn't notice much of an improvement. Yes, yes, I know, but Apple sucks. I would call the emulator borderline unusable for development and almost not usable for testing because of its bad performance.

    I'd like to try some of the resources he mentioned in the article, but I only found out about them two minutes ago when I read the article. As a noob, I didn't even know they existed. Tools do matter. As Microsoft and Apple have found out, creating really nice development environments is important in capturing mind share. At some point every developer is a noob at something and making easier for the noobs to get going is part of making a platform sticky.

    So let the grammar corrections, the Microsoft sucks, the Apple sucks comments come. It doesn't change the fact that being productive isn't just about which APIs you can memorize, but also about the toolchains and environments you use to write code.

    --
    Leave the gun, take the cannoli -- Clemenza, The Godfather