The top news of the Embarcadero company in 2013, as well as the direct reason for RAD Studio XE5 release, was certainly support for Android. Android is now of rather great interest for programmers, therefore its support in the Embarcadero’s product in a certain way increased activity in the Delphi community.
With the release of ХЕ5, in a variety of specialized blogs, there appeared publications concerning development of “my first application” for the new platform, in which it is described in details how to create, run, and debug a project. Due to the specifics of the products produced by our company, while preparing for the recent release, we were most interested in the debug process, some peculiarities of which we want to discuss here.
In contrast to the iOS platform, exclusively supported by Apple devices only, Android market is literally flooded with devices by all kinds of vendors. The Embarcadero company doesn’t make any special requirements, but in the official documentation (as well as in publications mentioned above), there are reflected test results for leading global manufacturers only (Google, HTC, Sony, etc.). Certainly, the IDE interacts with “branded” devices with no problems. And we aimed to test our products workability on a maximum number of devices, as well as on devices from the well-known Chinese manufacturer “no-name”.
The process of launching and debugging an Android-application starts with connecting an Android-device to a PC via a USB cable (Android USB Debugging), after that the device is detected by the IDE and appears in the “Target Platforms” list. However, for many Chinese tablets, it would seem, the first and most simple step becomes an insurmountable obstacle due to the fact that there are no drivers on the developer’s website, as well as no website, and the device cannot be detected by the OS. The problem can be resolved by debugging via Wi-Fi. This solution is essentially universal, because the Wi-Fi technology is supported by an absolute majority of devices.
The solution is to perform three simple steps:
- Set up a Wi-Fi connection on the Android-device to the network, to which the computer with RAD Studio XE5 is connected;
- Launch a special “ADB-over-WiFi” application on the Android-device. There is now a plenty of such applications, including free, therefore the choice of the most convenient one remains for developer;
- Using the ADB (Android Debug Bridge) tool, included in Android SDK, set a connection to the device from the computer, on which RAD Studio XE5 is installed.
Description of setting up Wi-Fi connection on the device makes no sense, so let’s move on to the second step.
As mentioned above, there is a sufficient number of applications for work with ADB via Wi-Fi, so developer is free to choose any of them. As an example, the free “ADB over WiFi” tool can be taken, that can be easily found and installed via Google Play. When launching the application, the IP-address of the device and the used port will be displayed on the application icon. This information will be useful in the next step, when establishing a connection to the ADB-server.
Now, when the device is plugged in, a connection to ADB can be established. For this, on the computer, where RAD Studio XE5 is installed, the adb.exe utility should be launched, that is located in the Android SDK folder (by default, Android SDK is installed to “C:UsersPublicDocumentsRAD Studio12.0PlatformSDKsadt-bundle-windows-…”), in the “sdkplatform-tools” sub-directory. As adb.exe start parameters, the connect command and the IP-address and Port of the device should be specified, that we retrieved at the previous step.
The device is ready to use, that can be checked by looking at the list of devices in the IDE.
The further process of developing and debugging the application is no different from the “wired” one using USB connection.
Using remote debug significantly simplified the process of development and debug of our Delphi Data Access Components for Android, and we hope our experience will help you quickly master the new development platform.
thanks it work fine.