Categories
Android Mobile

Delphi XE5 Android Device Compatibility

Unlike iOS, there are are a huge variety of Android devices. Delphi XE5 supports the large majority of those devices. The official page for Android Devices Supported for Application Development spells out the requirements of Gingerbread, Ice Cream Sandwich or Jelly Bean on an ARMv7 processor (with NEON instructions). The NEON instruction requirement excludes the TEGRA 2 processor which was apparently popular in some tablets (mostly) a few years back. Also excluded is the Intel Atom processor, which I hear is showing up in Android devices in Japan.

If you look at the Android Dashboard we see those versions of Android make up 87.5% of the Android devices accessing the Android store. What that doesn’t tell us is how many of those devices have ARMv7 with NEON instructions. The DocWiki page also includes a number of devices that were tested for various functions, but really in the grand scope of possible Android devices it is a rather small sample.

Android versions pie chart

So I had the idea of using Apkudo. They provide an online service where you upload your Android app APK and they run it on a wide variety of devices and tell you how it did. Currently I’ve only done a “hello world” type app test, but it gives a good guide for devices that support XE5 at a minimum level.

They have 118 devices that run Android 2.3.3 (Gingerbread) or better (no Honeycomb). Our of those devices, my APK failed to install on 10 devices. Looking at the log it either timed out, or was out of storage space, so that may be more related to the state of the device before the test than any issues with the actual app.  Out of the 108 devices that loaded and ran the app, it only failed (ANR = Application Not Responding) on 3.

  • Devices tested: 118
  • Failed to install: 10
  • Locked up: 3
  • Successfully ran: 105
  • Success rate: 89%

From what I hear it isn’t uncommon for an app to fail for no reason on some of these devices, due to other influences (like no storage space). So that rate may actually be higherI’ve shared the full spreadsheet report here for you to look for your favorite devices. (They don’t provided a download of the report, so I had to transcribe it to the spreadsheet. There may be typos.)

I plan to modify some of our existing test apps and upload them. Since the test system just uses monkey it isn’t guaranteed to actually perform the specific actions of the test apps, so I need to automate that part of the app. When I do I will update that spreadsheet and provide an updated post.

I’m sure some people will point out that you could use Java and reached more devices. Instead of focusing on the small percentage of Android devices you are missing with Delphi XE5, I’d instead invite you to consider the millions of iOS devices you can target from the same code base. Including iOS 7!

You can get started now by downloading the Delphi XE5 trial.

Categories
Android Debugging Mobile

Debugging Against a Remote Android Emulator

The Android emulator is impossibly slow when running inside a virtual machine. It is possible to debug against a remote emulator via SSH. Here are the steps to connect from a Windows guest OS to an OS X host OS (they can be easily adapted for a Windows host). It does require installing the Android SDK on the host OS and creating and running an emulator there. It seems to work even if you have a device connected too. I’ve gotten them both to show up in the IDE and am able to pick between them and deploy and run on the emulator.  The Emulator is still slower than hardware, but this makes it usable.

Of note, this emulator performance isn’t an issue with Delphi, but is an issue with the Android emulator. So you may find this tip useful with other Android development tools as well.

This could be adapted to debug against a remote Android Emulator running on a remote machine located anywhere on the internet. Just requires port 22 to be open between the two machines.

Thanks to hheimbuerger for the the Stack Overflow answer that got me pointed in the right direction. This information has been adapted to the DocWiki too with additional links to more information.

  1. Install the Android SDK (not the ADT bundle) on your Mac OS X host & start an ARM based emulator (With use Host GPU enabled)
  2. Enable SSH on the host
    • On a Mac OS X Host go to System Preferences -> Sharing -> Remote Login
    • On a Windows host, you need to install a 3rd party SSH host. FreeSSHd has been found to work.
  3. Install the PuTTY SSH (putty.exe) client on the Windows Guest OS
  4. Ensure port 22 is open between the Windows guest OS and the Mac OS X host.
  5. Create a connection in PuTTY to the Host OS
    1. You will most likely use the 192.168.x.x IP address of the host
    2. Go to Connection -> SSH -> Tunnels and add a local/auto port forwarding for 5555 to locahost:5555 and 5554 to localhost:5554.
  6. Save and Open the connection in PuTTY
  7. Provide the login credentials for the Mac OS X host – anything typed in this window is executed on the remote machine
  8. You can check or change the tunnel settings via the icon in the upper left of the PuTTY window
  9. Minimize PuTTY (keep it open to maintain the SSH connection)
  10. Open a new command window in the Windows guest OS and type “adb kill-server & adb devices” and you should see the emulator-5554 as a listed device.
  11. Refresh target devices in Delphi and it should appear

PuTTY Tunnels

This should work for any emulators or devices connected to the remote machine. Unlike emulators that are local, you need to start the emulators before Delphi will see them. You may need to adjust the tunnel port numbers if you are connecting multiple devices.

Good luck, and happy debugging!