How to force Delphi to use D8.bat instead of dx.bat to compile Java 1.8 bytecode into DEX bytecode

  

Today I faced a problem. My project needs to use some libraries (*.jar) that use Java 1.8 features. I see more and more libraries use now Java 1.8 features (like webRTC, exoplayer, etc.). In this way, we must do desugaring.

Desugaring allows you to use these features on older devices by replacing new bytecodes and language APIs with older ones during the build process

With d8.bat (replacement of dx.bat), desugaring is turned on by default. So you can now use most of the latest language changes while targeting older devices.

When we compile a project, in the background Delphi does this:

dx.bat –dex –output=”C:\Dev\output\libwebrtc-dexed.jar” “C:\Dev\lib\libwebrtc.jar”

And this fails with a library that contains Java 1.8 features.

So Delphi must do this instead:

d8.bat –lib C:\SDKs\android-sdk-windows\platforms\android-28\android.jar –output=”C:\Dev\output\libwebrtc-dexed.jar” “C:\Dev\lib\libwebrtc.jar”

Any idea how I can tell Delphi to use d8.bat instead of dx.bat?

Comments are closed.