📜 ⬆️ ⬇️

How to configure Android and RAD Studio XE7 (Delphi, C ++ Builder)

Let's talk about how to "make friends" or configure Android and RAD Studio XE7 (or Delphi, or C ++ Builder, or AppMethod).
In fact, the question is not very complicated, but often the questions on this topic prompted me to write this post.

Action plan:
- Configure RAD Studio XE7 (SDK + NDK);
- setting up an Android device;
- launch your application on your Android device.

So, let's begin!

Characters:
')
- RAD Studio XE7 (the latest version at the time of this writing);


- Three wonderful devices:
Samsung Galaxy Tab S 8.4 (SM-T700);
Samsung Galaxy Tab S 10.5 (SM-T800);
Samsung Galaxy Note Edge (SM-N915F).


- You still need regular USB cables. You can use one and connect devices one at a time, or use three USB cables, but this is optional.


Let's get started! :)

1. Install RAD Studio XE7 + SDK and NDK.


I will use my laptop with Windows 8 64x.
During the installation of RAD Studio XE7, I don’t touch the Android SDK and Android NDK checkboxes. By default, the checkboxes are set; after installation, these two libraries will be installed and configured automatically.


1.1. Configure paths to the SDK and NDK (this item is optional).
If for some reason you did not install the SDK and NDK during the installation of RAD Studio, then configure them yourself.
In RAD Studio, go to the Tools -> Options menu, there we find the “SDK Manager” tab, then we independently check and configure the paths to the libraries.


1.2. Update SDK library (optional).
In rare cases, you may need to update the SDK library. To do this, run the "Android SDK Manager" and click on the button "Install N packages ...". Further from the Internet will be downloaded and installed.
Latest updates.


2. Activation of the developer mode on the Android device.


I take the tablet in my hands and go into its settings, there I find the item "About the device".
Then I find the “build number” and click on it 7 times in a row. After that, the hidden item “Developer options” is activated, I go into it and check the box next to “USB debugging”.
I repeat the same for the rest of my devices.


3. Installing drivers on the Android device.


To do this, I alternately connect each tablet via a USB cable to my laptop.
Next, I go to the "Device Manager" and make sure that all the drivers are installed. In my case, they are installed automatically. If the drivers are not installed automatically, then you need to go to the website of the manufacturer of your tablet, download and install them yourself. Make sure that all devices are defined in the “Device Manager”.
I repeat the same for the rest of my devices.


4. Enable USB debugging.


After installing the drivers, you need to completely disconnect the Android device from the PC by pulling out the USB cable and reconnecting it. Wait until the prompt “Allow USB debugging" appears on the Android device itself, check the box "Always allow this computer" below and click "Yes."


5. Run RAD Studio.


Only at this stage I launch RAD Studio.
I create a new Multi-Device Application project and in the “Project Manager” double-click I activate the Android platform (it is highlighted in bold). Next, I open the Target list with a plus; if the device does not appear, then right-click on Target and from the drop-down list - on Refresh. All three devices I have decided on the first time.


6. Run the application.


I launch my application on an Android device. That's so simple :)


And finally.

It must be remembered that it is not at all necessary to debug every launch of your application on the device. Delphi allows you to do this quickly and comfortably. All logic can be debugged in the Windows environment, and then check how the application runs on the device itself.

It is important to remember that we are creating a cross-platform application right away, so all platform-specific classes or constructions should be rendered separately from the main code.

And a few related links:
Enabling USB Debugging on an Android Device
docwiki.embarcadero.com/RADStudio/XE7/en/Enabling_USB_Debugging_on_an_Android_Device
Installing the USB Driver for Your Android Device
docwiki.embarcadero.com/RADStudio/XE7/en/Installing_the_USB_Driver_for_Your_Android_Device
Running Your Android Application on an Android Device
docwiki.embarcadero.com/RADStudio/XE7/en/Running_Your_Android_Application_on_an_Android_Device

Good luck to all!

Source: https://habr.com/ru/post/253929/


All Articles