Jump to content
hackbrew

Delphi 10.4.2 add support for Android 13

Recommended Posts

I'm running Delphi 10.4.2 and trying to add in Android 13 (API level 33) via SDK Manager. When I go to Tools-->Options-->Deployment-SDK Manager and attempt to modify the path for SDK Base Path to point to the new Android (API level 33) SDK I get an Invalid Path.

 

My current paths in Delphi SDK Manager are:

SDK Base Path: C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-2525-21.0.37889.9797
NDK Base Path: C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidNDK-21-21.0.37889.9797\android-ndk-r21

 

I tried pointing to this path showing in my Android Studio SDK Manager C:\Users\standard user\AppData\Local\Android\Sdk\build-tools\33.0.2, and just C:\Users\standard user\AppData\Local\Android\Sdk, which is where my Android Studio files reside, but I keep getting the invalid path error.

 

In Delphi, I noticed on the Java tab of SDK Manager that the Jarsigner path shows C:\Program Files\AdoptOpenJDK\jdk-8.0.242.08-hotspot\bin\JarSigner.exe. I did read that Delphi 10.4.2 is using Jarsigner instead of APKSigner, which is required for APKs with a target SDK of 30 or higher. A thread mentioned that API level 30 or above must now be also signed using APK Signature Scheme v2 or higher.

 

What do I need to do to get this working properly?

Share this post


Link to post

@hackbrew

 

I would try the following:

  1. first, update the Android SDK/NDK files for correct use in Delphi;
    1. you can find here on the forum a post of mine on how to manually update the Android SDK/NDK, instead of using Android Studio, as there is a small incompatibility of the configuration files generated by it, and, the manual update of Android ( SKDManager.bat) from the command line! However, if you don't mind some "Warnings", you can use any of the SDK/NDK update ways (I use the manual update)
  2. after that, you can use JAVA JDK or AdoptOpenJDK, as specified by Embarcado: then follow the Embarcadero requirement (I use AdoptOpenJDK by default)
  3. now, in Delphi, always prefer to delete the old settings and recreate them so that there is no question about the paths!

 

NOTE: Please note that Delphi does not use the latest releases, but rather points to a certain version, so anything outside of that is up to you!

 

https://en.delphipraxis.net/topic/7949-problem-on-update-sdk-ndk-in-delphi-11/?tab=comments#comment-66699

 

Edited by programmerdelphi2k

Share this post


Link to post
5 hours ago, hackbrew said:

I'm running Delphi 10.4.2 and trying to add in Android 13 (API level 33) via SDK Manager. When I go to Tools-->Options-->Deployment-SDK Manager and attempt to modify the path for SDK Base Path to point to the new Android (API level 33) SDK I get an Invalid Path.

You should not need to modify the base path. You should only need to ensure API 33 level and Build Tools 33.x are installed, and change the paths for the Build Tools related locations, and the SDK API Level location.

5 hours ago, hackbrew said:

I did read that Delphi 10.4.2 is using Jarsigner instead of APKSigner

APKSigner is part of the Android SDK, not Java SDK.

See this post, and the replies that follow: 

 

Share this post


Link to post

@programmerdelphi2k Okay. So following your other thread on the forum I have located the sdkmanager.bat at C:\Users\mh standard\AppData\Local\Android\Sdk\tools\bin. So that I'm following you correctly, for the first of the 3 command line commands I tried to run: sdkmanager.bat --sdk_root=C:\Users\mh standard\AppData\Local\Android\Sdk "build-tools;33.0.2" "cmdline-tools;v5".  When run that gave me the message below: 

 

Warning: Failed to find package standard\AppData\Local\Android\Sdk
[===                                    ] 10% Computing updates...

Share this post


Link to post

@Dave Nottage

These folders were copied during the Install of Android Studio. Now here's what's in my C:\Users\mh standard\AppData\Local\Android\Sdk folder :

image.png.a068300bb92f74c47d52aefd37b94119.png

 

I created a new folder C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-33.0.2 and copied in the build-tools, platforms, platform-tools, and tools folders. Assuming I need to modify the paths in Delphi SDK Manager. Are there any other files required?

Share this post


Link to post
36 minutes ago, hackbrew said:

When run that gave me the message below: 

  • As I said: if you used Android Studio to update your SDK/NDK -> you'll have an "incompatibility" if using "MANUAL UPDATES command-line" -> In this case, use "Android Studio" to avoid anything!
  •  
  • the Android SDK/NDK can be in any drive or folder, not necessary in C:\Users\Public\ etc....
  •  
  • if using command-line "SDKManager.BAT"
    • first, in your prompt command type this:    set REPO_OS_OVERRIDE=windows    --> to download only MSWindows O.S.
    • <<Path root of your Android SDK>> = where is the SDK root, in my case it is in:  D:\SDKsRAD\AndroidSDK
      • sdkmanager.bat --sdk_root=<<Path root of your Android SDK>> --help                                      -> >:_) 
      • sdkmanager.bat --sdk_root=<<Path root of your Android SDK>> --list_installed                         -> to see what packages is in your pc!
      • sdkmanager.bat --sdk_root=<<Path root of your Android SDK>> --list                                         -> to see what packages is in on Google to download!
      • sdkmanager.bat --sdk_root=<<Path root of your Android SDK>> --update "package name"     -> to update the package is in your pc! (download from Google)
      • sdkmanager.bat --sdk_root=<<Path root of your Android SDK>> --install  "package name"      -> to install a new package in your pc! (download from Google)
  • then, a sample in my case:
    • sdkmanager.bat     --sdk_root=D:\SDKsRAD\AndroidSDK   --install   "MyPackXYZ2023"  "MyOtherPackABC2024"  ... etc...

You can download the last "command-line" tools from Android Studio official site, if you need!

https://developer.android.com/studio

 

image.png.3a4da7ecc751e6263ca3acfb13f5ea78.png

Edited by programmerdelphi2k

Share this post


Link to post

Okay, thank you. Some progress. I added all the paths in the Delphi SDK Manager and Delphi accepted them, but it named the platform Android SDK 26.1.1 when doing both 32 and 64-bit. I'm not sure why?

I then tried to build a simple test program. I added the new platform and when I go to build it returns a long path "[Exec Error] The command "PATH \bin;C:\Program Files..." an exited with code 9009 error. Is this because the building script is not compatible with the SDK that Delphi installed?

 

I get the same error with the device connected or not.

Edited by hackbrew
Additional info

Share this post


Link to post
12 minutes ago, hackbrew said:

it named the platform Android SDK 26.1.1 when doing both 32 and 64-bit

Because it's the version of the SDK. When referring to API level being 33, it means just that: API level, not SDK version. Unfortunately Google decided to use names in the manifest like minSdkVersion and targetSdkVersion, when they actually refer to API level.

16 minutes ago, hackbrew said:

exited with code 9009 error

9009 means the executable was not found. One of your paths in the SDK settings may still be wrong.

Share this post


Link to post
1 hour ago, hackbrew said:

PATH \bin;C:\Program Files..."

I think that should be  %PATH%  or any other environment variable NOT?

 

in fact, you dont need add cmd-tool path on O.S. "PATH' , because that Android use itself vars and setup to find all tools, like do the Delphi when building... of course, you can do it, but it's not really necessary. 

 

See the Android.Bat and all batch files called... all it's defined for it.

 

Java/AdoptOpen define its var on O.S. "PATH" var when installed. of course, verify if dont exists more than one on PATH!!!

Edited by programmerdelphi2k

Share this post


Link to post
1 hour ago, hackbrew said:

but it named the platform Android SDK 26.1.1 when doing both 32 and 64-bit.

not problem, see on SDK Manager tab the line SDK API Level, there youchoice what API you can use when compiling... same that your target dont use last version

 

 

https://docwiki.embarcadero.com/RADStudio/Alexandria/en/SDK_Manager

images.jpeg

Edited by programmerdelphi2k

Share this post


Link to post

I do notice that in the path "C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-33.0.2\platforms" besides 
the folder that I'm pointing to (android-33), there is also a folder named "android-33-ext5". The paths defined in Delphi look correct to me. Here are the paths:

image.thumb.png.749c94cebc8c65ed239ceb695de16afc.png

Share this post


Link to post

@programmerdelphi2k @Dave Nottage Update: I ran adb version and this is what it showed: Android Debug Bridge version 1.0.41    Version 33.0.3-8952118. Since in Delphi SDK Manager, I was pointed to an AndroidSDK-33.0.2 folder, I created a C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-33.0.3\ folder and copied what I thought were the required files there. I then updated my paths in Delphi, but still no luck. 

 

At this point, I'm not sure if I'm close or not, but I think I'm making it way too complicated, based on having multiple versions in multiple places. With that said, I thinking of starting over to simplify the process. If you agree, would you recommend that I uninstall Android Studio (which I don't really use) and move forward by running from the command-line with SDKManager.BAT to update?

Share this post


Link to post

@hackbrew

look, really you dont need Android Studio! 

 

then, try this:

  1. when you install your RAD, you'll have SDK (almost empty), and NDK (basic content) folders! ok  -> BUT, you can "COPY" (this folders it's not really installed by "installer", just unziped)  this folders from any PC, just stay alert about version used for each RAD!!!
  2. this said, you can copy from another pc (or install a RAD in a VM and copy this 2 folders... later, just delete a new VM)
  3. now, in "CMDLINE-TOOLS\bin" folder you have the "SKDManager.bat", if DONT, just download the last version from "cmdline-tools" from Android Studio official site 
  4. now, just do it as above!

Share this post


Link to post

@programmerdelphi2k Okay, I removed Android Studio and downloaded the last version of "cmdline-tools" from Android Studio official site. I created a new empty folder named C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-33.0.3. I then extracted the zip and it made a cmdline-tools folder in my new AndroidSDK-33.0.3 folder. At this point, that's all (cmdline-tools) that's in that folder.

 

Now, from the Windows command line I will execute cd C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-33.0.3\cmdline-tools\bin> to get to the proper folder.

Next, do I proceed with the first command you recommended (sdkmanager set REPO_OS_OVERRIDE=windows) or do I first need separate SDK and NDK folders? If I need the folders, should I just copy the folders (AndroidSDK-2525-21.0.37889.9797) from what was created when I installed Delphi (seen here)?

image.png.df94c6942348c8c39708444f34950dcf.png

 

Share this post


Link to post

@hackbrew

 

my tip 1: use a "short path to SDK/NDK folders" like:

  • c:\mySDKs\AndroidSDK25
  • c:\mySDKs\AndroidNDK21
  • it's more easy to works, including when use SdkManager --sdk_root=....  you see?

now, next...

  1. set the environment var REPO_OS_OVERRIDE=windows
  2. use SDKManager to see what packages YOU HAVE, and what YOU WANT!!! --List  /  --List_Installed
  3. update or install it.... --update /  --install
  4. try this tips

after all, use RAD options to create you new Sdk/Ndk setup.

pay attention if you are using the JavaJdk OR AdoptOpenJdk in you "PATH" enviroment variable!

Edited by programmerdelphi2k

Share this post


Link to post

@programmerdelphi2kOkay, progress. I created easier folder names as you suggested, and copied the folders/files from Delphi SDK install there. I then executed:

 

C:\AndroidSDKs\AndroidSDK25\tools\bin>sdkmanager --list
Warning: File C:\Users\myAdmin\.android\repositories.cfg could not be loaded.
Installed packages:
  Path                 | Version | Description                       | Location
  -------              | ------- | -------                           | -------
  build-tools;29.0.3   | 29.0.3  | Android SDK Build-Tools 29.0.3    | build-tools\29.0.3\
  platform-tools       | 29.0.6  | Android SDK Platform-Tools 29.0.6 | platform-tools\
  platforms;android-29 | 4       | Android SDK Platform 29, rev 4    | platforms\android-29\
  tools                | 25.2.5  | Android SDK Tools 25.2.5          | tools\

Available Packages:

 

// About 100 lines of available stuff loaded here

 

Available Updates:
  ID                   | Installed | Available
  -------              | -------   | -------
  platform-tools       | 29.0.6    | 34.0.3
  platforms;android-29 | 4         | 5
done

 

I got the warning that repositories.cfg could not be loaded. That may be a permissions issue as that folder is under the Admin user of this workstation I'm running on. Should that be copied somewhere else? Am I reading it correctly, that it will load android-29 and not android-33 if I update? I'm trying to target Android 13.

Share this post


Link to post
4 minutes ago, hackbrew said:

C:\Users\myAdmin\.android\repositories.cfg

maybe residual files when using Android Studio,  try delete this folder:  .Android

Edited by programmerdelphi2k

Share this post


Link to post

So at the command line just run sdkmanager C:\AndroidSDKs\AndroidSDK25 and it will install or do I need the parameters sdkmanager --sdk_root=C:\AndroidSDKs\AndroidSDK25?

 

Edited by hackbrew
Update

Share this post


Link to post
5 minutes ago, hackbrew said:

sdk_root=

always need say where SDK is in!

because you can download many others versions u see?

Edited by programmerdelphi2k

Share this post


Link to post

It didn't like it >sdkmanager --sdk_root=C:\AndroidSDKs\AndroidSDK25
Usage:
  sdkmanager [--uninstall] [<common args>] \
    [--package_file <package-file>] [<packages>...]
  sdkmanager --update [<common args>]
  sdkmanager --list [<common args>]

Share this post


Link to post

I got a long Terms and Conditions EULA, so it must have worked. It ran when I typed the command:

sdkmanager --update --sdk_root=>sdkmanager --sdk_root=C:\AndroidSDKs\AndroidSDK25\

 

It appeared to update to:

repositories.cfg could not be loaded.
Installed packages:
  Path                 | Version | Description                    | Location
  -------              | ------- | -------                        | -------
  build-tools;29.0.3   | 29.0.3  | Android SDK Build-Tools 29.0.3 | build-tools\29.0.3\
  platform-tools       | 34.0.3  | Android SDK Platform-Tools     | platform-tools\
  platforms;android-29 | 5       | Android SDK Platform 29        | platforms\android-29\
  tools                | 25.2.5  | Android SDK Tools 25.2.5       | tools\

 

I updated the paths in Delphi SDK Manager and tried to compile/run an App. I got 541 errors which I think are all now coming from AndroidNDK like this : [DCC Error] E2597 C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidNDK-21-21.0.40680.4203\android-ndk-r21\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.exe: error: c:\program files (x86)\embarcadero\studio\21.0\lib\Android64\debug\SysInit.o: incompatible target

 

When you say, "Embarcadero dont use the last updates, then use the expected only.", what version of the NDK should I download from Google? 

image.png.591da1984e0fcf644edb21b87751c136.png

Edited by hackbrew
Additional info

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×