Fixing Illegal -digestalg error in Delphi 13 Android builds

Summary

The Delphi 13 deployment process for Android 64 signed APKs is failing due to an Illegal option: -digestalg error. This error occurs when the KeyTool.exe is executed with an invalid option, preventing the successful deployment of the application.

Root Cause

The root cause of this issue is the incorrect usage of the -digestalg option in the KeyTool.exe command. The possible causes include:

  • Incorrect configuration of the JAVA_TOOL_OPTIONS environment variable
  • Incompatible version of the Java Development Kit (JDK) being used
  • Incorrect command-line options passed to the KeyTool.exe

Why This Happens in Real Systems

This issue can occur in real systems due to:

  • Misconfigured environment variables: The JAVA_TOOL_OPTIONS environment variable may be set incorrectly, causing the KeyTool.exe to fail
  • Outdated or incompatible JDK versions: Using an outdated or incompatible version of the JDK can lead to compatibility issues with the KeyTool.exe
  • Human error: Incorrect command-line options or configuration can cause the KeyTool.exe to fail

Real-World Impact

The real-world impact of this issue includes:

  • Failed deployment: The application cannot be deployed to the target device, resulting in delays and lost productivity
  • Security risks: The use of incorrect or outdated security protocols can expose the application and its users to security risks
  • Development delays: The time spent troubleshooting and resolving this issue can delay the development and release of the application

Example or Code (if necessary and relevant)

keytool -keystore "D:\MyKeys.jks" -storepass mypass -keypass mypas -sigalg SHA256withRSA "D:\MyProject\bin\Myapp.aab" "myapp"

Note: The above code snippet demonstrates the correct usage of the KeyTool.exe command without the -digestalg option.

How Senior Engineers Fix It

Senior engineers can fix this issue by:

  • Verifying the JDK version: Ensuring that the correct version of the JDK is being used
  • Configuring environment variables: Correctly setting the JAVA_TOOL_OPTIONS environment variable
  • Updating command-line options: Removing the -digestalg option and using the correct command-line options for the KeyTool.exe

Why Juniors Miss It

Junior engineers may miss this issue due to:

  • Lack of experience: Limited experience with the Delphi 13 deployment process and the KeyTool.exe command
  • Insufficient knowledge: Limited knowledge of the JDK and its compatibility issues
  • Inadequate testing: Failure to thoroughly test the deployment process and identify potential errors

Leave a Comment