1

I used to create dex file with dx.bat like this :

"c:\SDKs\android\build-tools\32.0.0\dx.bat" --dex --output=C:\Dev\MagicFoundation\Alcinoe\Tools\AddRJavaToClassesDex\tmp\classes.dex C:\Dev\MagicFoundation\Alcinoe\Tools\AddRJavaToClassesDex\tmp\obj.zip

How to do the same with d8.bat?

zeus
  • 12,173
  • 9
  • 63
  • 184

2 Answers2

2

Creating DEX file using d8 can be achieved using:

d8 --output <output-folder> <input-files>

In your case, the following is an equivalent:

c:\SDKs\android\build-tools\32.0.0\d8.bat --output C:\Dev\MagicFoundation\Alcinoe\Tools\AddRJavaToClassesDex\tmp C:\Dev\MagicFoundation\Alcinoe\Tools\AddRJavaToClassesDex\tmp\obj.zip
Alex Lipov
  • 13,503
  • 5
  • 64
  • 87
1

To anyone who is using d8.bat with OpenJDK-11, if you encounter the error when running d8.bat:

-Djava.ext.dirs=${PathToAndroidSDK}\build-tools${BuildToolVersion}\lib is not supported. Use -classpath instead.

Error: Could not create the Java Virtual Machine.

Error: A fatal exception has occurred. Program will exit.

You can edit d8.bat with a text editor, replacing the code -Djava.ext.dirs="%frameworkdir%" in last line to -classpath "%frameworkdir%" to fix the error.

Shawlaw
  • 516
  • 4
  • 11