Categories
MVP

New MVPs & Directory

Another round of new Embarcadero MVPs

  • Chris Rolliston
  • Marcos Lizarraga
  • Rudy Velthuis
  • Christina Louise Warne
  • Bertie Buitendag
  • CHUA Chee Wee
  • Warren Postma
  • Bruce McGee

You can learn more about them, and our other MVPs in the newly redesigned MVP Directory.

Here are some pics of a few of the MVPs

Brazil

The Brazilian MVPs from the Embarcadero Conference a couple weeks ago!

Samuel1

A picture by Samuel David to promote his session at the conference.

Samuel2

He wore the leather coat and hat all day too, even when posing with the Android!

Xavier1

This is a picture of Xavier Martínez. That is him on the bottom. He is involved in Castells or “Human Towers”. Pretty amazing if you ask me!

Xavier2

Categories
Android Debugging

8 Tips to Speed Up Your Android ARM Emulator (AVD)

The Android Emulator is very slow. The main reason is because it is emulating the ARM CPU & GPU, unlike the iOS Simulator, which runs x86 code instead of the ARM code that runs on the actual hardware. This means the iOS Simulator is typically faster than actual hardware, and the Android Emulator is slower than actual hardware. Most Android developers I talk to develop on actual hardware, but sometimes you need the emulator, and when you are using it you need it to run faster.

You may see some articles or tips about using the Intel HAXM, BlueStacks, Genymotion, Android-x86 or some other high performance Android emulator. These almost always are using an x86/Atom Android image, which runs faster because it doesn’t need to emulate the CPU, running x86 code on your host CPU (much like the iOS Simulator). Yes, they are faster, but the majority of Android devices (in the USA at least) are ARMv7. So you are technically testing on a niche hardware configuration that is not likely to be what your app runs on in the real world. In some parts of the world, Intel Atom based Android devices are becoming more common, so those emulators do serve a purpose.

The Android Emulator runs an Android Virtual Device or AVD. You can configure and create different Android Virtual Devices with the Android Virtual Device Manager or from the adb command-line tool.

Here are some tips to make the ARM Android emulator faster for any Android development tool, but my examples are specific to Delphi XE5. Many of these tips can be combined for better performance. Using these tips I’ve seen the emulator go from sluggishly terrible to actually usable on a few different systems.

  1. Use Actual Hardware – OK, so this doesn’t speed up the emulator, but it is worth mentioning again. There are a number of other advantages besides speed, and Android hardware is pretty cheap compared to iOS hardware. Get a few different devices, and you are set.
  2. Don’t Run the Emulator in a Virtual Machine – The emulator is a virtual machine, and running a virtual machine in a virtual machine just compounds the problem. If you are developing in a virtual machine, all is not lost, you can still debug against a remote emulator to run the emulator on the host machine.
  3. Use Parallels Desktop 9 – If you must run the emulator in a virtual machine (which I don’t recommend) I hear reports that Parallels Desktop 9 for Mac OS X is faster than VMWare Fusion. You can test this for yourself with the latest version of VMWare Fusion. The comparison I heard about was between Parallels 9 and Fusion 5, which is now a version behind.
  4. Use Host GPU – There is an option when creating an Android Emulator Instance (called an AVD or Android Virtual Machine) to use the physical GPU on the host machine instead of emulating it in software. This gives a huge performance boost. So create a new Android Emulator, and make sure to enable Use Host GPU. (Not, this is incompatible with the other performance option of Snapshot, but I’ve found Use Host GPU results in better emulator performance, while Snapshot only speeds up emulator startup.)
  5. Copy the OpenGLES libraries – After launching an emulator with Use Host GPU enabled, sometimes you get an error “Could not load OPENGLES emulation library”. If you do, then use this tip (if you don’t get the error, then skip this tip).OpenGLES errorThis has two common causes, the first is fixed with a reboot. If that doesn’t work then you need to copy the necessary DLLs to a different directory so the emulator can find them. Simply copy lib*.* from C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk\tools\lib up one folder to C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk\tools (this is assuming you are using the Android tools installed by RAD Studio. Adjust your paths as necessary). Relaunch the emulator and the error should go away, and your emulator should be much faster. There is another method that involves updating path information, but just copying the necessary files is easier.
  6. Run your Emulator on a Mac – I’ve heard reports that the OpenGLES libraries are faster on Mac OS X than on Windows, because Windows prefers DirectX, while OS X prefers OpenGL. You can use the remote emulator setup to make that work (assuming you have a Mac handy). Likewise, if you have a computer with a newer and more powerful GPU and CPU, then use that one. Be sure you combine this tip with the previous two (to Use Host GPU).
  7. Run an Older Version of Android – Sure, Kit Kat is new and Shiney, but not everyone has it yet. The newer versions of Android are typically more demanding on the hardware, so newer  may be slower. Check out the Android Platform Version Dashboard and go back to an older, popular version, or just stick with Gingerbread and know you will support close to 98% of all Android devices.
  8. Tweak the AVD Hardware Configuration – One advantage of the using the Android Emulator is you can test specific hardware configurations, so this one is less useful. But if you increase the memory (within reason) and make the screen smaller (again within reason) that can give you a minor performance increase too.

Generally speaking, I would suggest everyone use tips 2, 4, 5 and maybe 7, but everyone’s situation and needs are different, so pick and test the tips that give you the best Android Emulator AVD performance possible. Good luck, and happy Android development and debugging!

Categories
Android News

More Complete Supported Android Devies List

The Delphi Wiki has a much more exhaustive Supported Android Devices list. It also includes the new Nexus 5 (running Kit Kat), Google Glass and Droid Razr M, to name a few. At the bottom of the list there are some BlackBerry devices listed too, all of which are either not tested, or not supported. Curious to see if any of those end up working

There is also a link to some easy to follow testing instructions if you want to test your own devices, including some scripts to help automate part of the process.

Looking at the list it is obvious that there are more supported devices than not. Most pass over 80% of the tests too, of course it is always nice to see specific devices verified.

Categories
Android Tools

Installing and Running Android Apps From Command-Line

Delphi automatically installs and runs your app for you, but sometimes it is nice to do manually from the command-line. Here are the commands you need. These all assume adb (Android Debug Bridge) is on your system path and you only have one Android device (or emulator) attached. They should work on both Mac and Windows.

See the end for notes on multiple devices or if you are running both an emulator and device.

First to install your app:

adb install path\ProjectName.apk

In this example path\ProjectName.apk is the full relative path to the apk. The apk usually has the same name as the project. If your apk is already installed, then use the following command to “reinstall” it, leaving the data intact:

adb install -r path\ProjectName.apk

The great thing about the -r is it works even if it wasn’t already installed.

Now if you want to uninstall your apk you can do that too:

adb shell pm uninstall -k com.embarcadero.ProjectName

Again, com.embarcadero.ProjectName is the default name of the package. If you changed it under Project Options -> Version Info -> Package, then use that value instead. BTW, the pm in there is the Android Package Manager.

One note, when Delphi deploys your app to run it, it performs an uninstall first. This results in all the data being cleaned out, which can be useful during development to be sure you don’t leave anything behind from the previous run. When a user updates an app from the App store, or installs it via most any other means, then it performs a reinstall, which leaves the data intact.

Now if you want to run it, things get a little more interesting. Now we use the Android Activity Manager (AM).

adb shell am start -n com.embarcadero.ProjectName/com.embarcadero.firemonkey.FMXNativeActivity

There are two parts to this. Before the slash is the package name, just like for uninstalling it. After the slash is the name of the Main Activity, which unless you’ve edited your AndroidManifest.template.xml (and some other fundamentals of your app) is always com.embarcadero.firemonkey.FMXNativeActivity. If you are trying to start an app written with another tool, then consult the AndroidManifest, but it is common for most tools to use MainActivity, so you can launch it like:

adb shell am start -n com.other.ProjectName/.MainActivity

If you want to stop your app after it is running, you just need the name of the package and the following:

adb shell am force-stop com.embarcadero.ProjectName

This can be useful to test what your app behaves like from a fresh restart, vs. just returning from the background.

The Android adb tool is very powerful. Most of these are using the shell command which actually allow you to pass commands to the modified Linux shell that runs inside Android. You can actually use “adb shell” to open a shell prompt and navigate your device like a remote machine.

If you have both an emulator running and a device attached then you can use the switch -d like

adb -d shell

and it directs it to the only device. If you use -e then it goes to the emulator.

When you have multiple devices then use -s and the device ID which can be obtained via the adb devices command.

There are so many other useful things you can do with adb. Check out the documentation.

Categories
Conferences News

Stops on My North America Tour

I just got back from Brazil and Costa Rica, which was great. Now I am headed out to different cities in North America (Yes, technical Costa Rica is in North America, but all these cities are north of Latin America). David I and Al Mannarino are also traveling across North America for a total of 27 cities. Here are my city stops:

Minneapolis – Meet and Eat
Wednesday, November 13, 2013 @ 12:00pm-2:00pm
Ruth’s Chris Steakhouse
920 2nd Avenue S #100, Minneapolis, MN
[Register]

St. Louis – Meet and Eat
Thursday, November 14, 2013 @ 12:00pm-2:00pm
Ruth’s Chris Steakhouse
315 Chestnut Street, St. Louis, MO
[Register]

Chicago – Hands on Workshop
Saturday, November 16, 2013 @ 9:30am-3:00pm
Hyatt Regency Woodfield – Schaumburg
1800 East Golf Road, Schaumburg, IL
[Register]

  • Wed, 20-Nov Vancouver, BC 12:00pm 2:00pm PST [Register]
  • Thu, 21-Nov Calgary, AB 12:00pm 2:00pm MST [Register]
  • Tue, 3-Dec Bellevue, WA 12:00pm 2:00pm PST [Register]
  • Tue, 3-Dec Bellevue (User Group), WA 6:00pm 8:00pm PST
  • Wed, 4-Dec Portland, OR 12:00pm 2:00pm PST [Register]
  • Wed, 4-Dec Portland, OR (User Group) 6:30pm 8:30pm PST
  • Thu, 5-Dec Boise, ID (User Group) 7:00pm to 9:00pm MST [Register]

I’m planning to bring my Google Glass and show off Delphi XE5 running on Google Glass too.

Categories
Android Delphi Projects Mobile News REST

Hello Google Glass from Delphi XE5

Google’s new Glass platform is a very revolutionary Android device, but the question I really wanted to know is if I could develop for it with Delphi XE5. Turns out the answer is Yes.

There are actually two different options for developing Glassware: Mirror API and GDK.

The first is the Google Mirror API, which allows you to build services, called Glassware, that interact with Google Glass. It provides this functionality over a cloud-based API and does not require running code on Glass. This is accomplished through a REST and JSON based API. Thanks to the new TRESTClient components in Delphi XE5 this should be easy enough to do.

The GDK on the other hand is the avenue where you build an actual APK that runs on the Google Glass device itself. This gives you the most access to the device, its sensors and features. Turns out this is also easy enough to do with Delphi XE5.

The actual GDK builds on top of the Android SDK. You can develop apps to run on Glass with either the Android SDK or GDK, but the GDK is necessary to take advantage of some of the Glass specific features.

If you run SysCheck on Glass (which takes some effort) you discover it has an ARMv7 PRocessor rev 3 (v71) with Android OS Version 4.0.4 and NEON support. Those meet the main requirements for Delphi XE5 development. So I created a simple Hello World app and ran it.

This first screenshot shows Glass appearing in the Project Manager as a valid target (once the required USB drivers were installed, which was tricky for glass).

HelloGlassProjectManager

Here is a screenshot of the app running on Glass

Delphi XE5 App running on Google Glass

I didn’t hide the status bar, which most Glassware does, and it does nothing other than serve the purpose of showing a Delphi XE5 app running on Google Glass. There were no special settings (other than the dark theme, which is a matter of taste) to make the app run on Glass. It just works.

And lastly a quick selfie of me and Glass, taken through glass.

JimWithGlass

I was hoping it would look more red than orange, but should have known Tangerine would be orange.

Rest assured, there will be more coverage of Delphi and Glass. We are just getting warmed up. This app was not using the GDK (which is still in Beta) but it is an actual Delphi app running on Glass. What an exciting day!