Dinesh M
Dinesh M

Reputation: 173

Problem installing Delphi 10.4 Android SDK

I have done an install of Delphi 10.4 Sydney on a machine with a clean Windows 10, accepting all the defaults. Yet the Android SDK clearly is not installed properly.

At a minimum Missing Directories: \android-29 & \29.0.3

C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-2525-21.0.37889.9797\platforms\android-29

C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-2525-21.0.37889.9797\build-tools\29.0.3

I have reinstalled the SDK but no change.

Can anyone help with the SDK install.

Upvotes: 4

Views: 11106

Answers (4)

user30478
user30478

Reputation: 401

Concise Answer:

I have encountered this problem in 10.4 and 11 too. The solution in a nutshell is use manual install of the sdk to a different folder and point to this in the option>deployment>sdk manager paths. Repeat the same with NDK. JDK(oracle or adopt) can be installed afterwards too and pointed to similarly. I follwed this Jim McKeeth article to download and use the CLI sdk manager as the gui manager doesn't exist anymore. Thankfully I was testing in a VM. First and foremost make sure you are installing the IDE to an x64 OS (There's no way around it). Be very careful with the apksigner.jar path input in the IDE since it is located in the nearby lib folder. It isn't the apksigner.bat in bin folder! Otherwise you get corrupt jar file error in the final stages of apk signing/aligning before deployement.

Expanded Answer:

Doesn't matter what state your SDK, NDK or JDK is after the RAD Studio Installer finishes, you can always add new SDK/delete SDK/edit these three in this dialog: enter image description here

A: From that linked article to set up the SDK, I 'added new' sdk in the dialog and deleted the previous two defaults (android 32 is obsolete anyway):

  1. download the seed content(commandlinetools-win-8512546_latest) from android.google to a new folder - call it AndroidSDK.
  2. Now instruct the CLI SDK Manager(by navigating up to it) to fulfill/download the full SDK: sdkmanager "build-tools;30.0.2" "extras;google;usb_driver" "platforms;android-31" "tools" "platform-tools" --sdk_root="C:\Users\Public\Documents\Embarcadero\Studio\AndroidSDK"These version numbers I get from what is supported by my current RAD Studio (11 Alexandria in my case). Also the last path is the arbitrary path which I called AndroidSDK before (container of the seed folder or equivalently couple of levels up than the CLI sdkmanager). Update the SDK paths in the above dialog while keeping in mind the apksigner.jar thing i told previously.

B: NDK is a straight-up download from android.google again which I extract to an arbitrary folder android-ndk-r21e. Update the same in the above dialog.

C: I used one of the latest jdk from oracle because the version differences can cause apk signing error. After ensuring it was in the windows path at the top, i updated the same in the above dialog.

Upvotes: 0

James L.
James L.

Reputation: 9453

I installed RAD Studio Enterprise, only Delphi (all platforms), not C++. I also installed:

  • Samples
  • Help
  • AdoptOpenJDK
  • Android SDK 25.2.5 - NDK r21

In Delphi, there were warning icons on the following:

Tools | Options | Deployment | SDK Manager | Android SDK ... | Properties
* SDK  - ZipAlign location
* SDK  - Adb location
* SDK  - Aapt location
* SDK  - SDK API-Level location
* Java - KeyTool location
* Java - Jarsigner location

To fix the Java issues, use Tools | Manage Platforms | Additional Options to remove both AdoptOpenJDK and the Android SDK. Then used it again to install both.

To fix the SDK issues, browse to the folder where the Android SDK was installed (look at SDK - SDK base path under the SDK Manager for Android). For me the path is:

c:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-2525-21.0.40680.4203

Run SDK Manager.exe to launch the Android SDK Manager application. For me, 16 packages were pre-selected, including rev 29 tools (which is the path that was in SDK API-Level location). The Google Play options under Android R wouldn't install because their download size didn't match the expected download size. So I removed Android R support. The others worked just fine.

Note: There is a SDK Readme.txt in the same folder that has some useful information. The readme mentions a command you can run from a command prompt (tools\android.bat update sdk --no-ui), which I ran. That installed support for several other versions of Android. Be sure to run it from the SDK folder, not the tools sub-folder.

Everything works now.

Upvotes: 1

Dinesh M
Dinesh M

Reputation: 173

This is what I found. The problem results from not selecting the option to also install AdoptOpenJDK. (I had the Oracle version installed) Once I Uninstalled Delphi removed the Oracle JDK, and reinstalled including AdoptOpenJDK the Automatic install of the Android SDK worked.

Upvotes: 4

user11648773
user11648773

Reputation:

You must install the platforms and other requirements separately. Use SDKManager.exe in SDK folder to install them. You can select which package you want to download by selecting the checkbox and then click Install to install those packages. By default SDK Manager keeps it up to date with latest APIs and other packages.

See this source for more information: https://www.tutorialspoint.com/android/android_sdk_manager.htm

Note that you can use different platforms and build-tools but sometimes this is not possible.

Upvotes: 1

Related Questions