java -jar d8.jar --help
Basic example – Convert a JAR of class files into one or more DEX files:
java -jar d8.jar myapp.jar --output output_dir/
Advanced options:
java -jar d8.jar \
--lib android.jar \ # Android framework classes
--release \ # Optimized release mode
--min-api 21 \ # Target Android API level
--no-desugaring \ # Skip Java language desugaring
--intermediate \ # For incremental compilation
input_classes/ \
--output output_dex/
The following are the key features of d8.jar: d8.jar download
You might find sketchy websites offering direct d8.jar downloads. Do not use them. These files could be:
Always obtain d8.jar from official Google sources. java -jar d8
Problem: Error: Could not find or load main class com.android.tools.r8.D8
Solution: Make sure you run java -jar d8.jar, not java -cp d8.jar .... The JAR’s manifest specifies the entry point.
Problem: Unsupported class file version
Solution: Downgrade your Java compiler target to Java 8 or 11. d8 supports class files up to Java 11 (and partially 17 in newer versions). Basic example – Convert a JAR of class
Problem: Needing android.jar for correct linking
Solution: Extract android.jar from an Android SDK platform (e.g., platforms/android-33/android.jar). Without it, d8 cannot resolve framework types like Activity.
To ensure compatibility with older Android devices, specify the minimum API level:
java -jar d8.jar --min-api 21 MyClass.class
The most reliable way to get d8.jar is through the Android Studio SDK Manager. This ensures you get a version compatible with your other build tools.
Locating the file:
Once installed, d8.jar is located inside your Android SDK directory:
Please to provide a secure URL with httpS
Please enter location
Please enter language
Please to select your preference language for website and for receiving email
Please fill in the "about" field
Please select a profile picture