Step-by-Step Guide to Convert Classes into Dex Format in Unity Easily

Unity is one of the most popular gaming engine and allows users to create immersive, high-quality 3D experiences for mobile, web, and console games. It also allows users to easily convert classes written in C++, C# and other languages into dex format. Dex format is the file format used by the Android Runtime (ART) which is a necessary component for running Android apps.

The process of converting classes into Dex format can be difficult and tedious if not done correctly. This guide aims to provide a step-by-step solution to convert classes into Dex format in Unity easily and efficiently.


The following things are required before the conversion takes place:

  • Unity Editor installed with the latest version
  • JDK up to 1.8
  • Android SDK with the required API level

Step by Step Process

  1. Open the Unity Editor and select the project for which you want to add the class.
  2. Select “Assets” from the status bar on the top of the Unity Editor.
  3. Navigate to the scripts folder and add your .cs or .js files here.
  4. Select “File” from the status bar and click on “Build Settings”
  5. Under “Platform” select “Android” and click on “Switch Platform”
  6. Enable “Development Build”
  7. Select “Player Settings” then navigate to “Other Settings”
  8. Change “Configuration” to “Developmment” then select “Scripting Backend” to “IL2CPP”
  9. Click on “Build” and save the output file
  10. Open the Command Prompt and navigate to the location of your Unity project
  11. Run the command
    java -jar <path_to_sdk>\build-tools\(version)\lib\dx.jar --dex --output=<path_to_dex>\classes.dex <path_to_unity_project>\Temp\StagingArea\classes.jar

This command will convert your class file into Dex format in your Unity project folder.


What is Dex Format?

Dex format is a format exclusive to Android apps and is used by the Android Runtime (ART) which is a necessary component for running Android apps.

What is the Difference between Dex Format and Classes.jar?

Classes.jar is the default Java format while Dex format is a file format exclusive to Android apps. Classes.jar must be converted into Dex format in order to run on Android devices.

How do I Convert Classes.jar into Dex Format?

The process of converting classes.jar into Dex format can be done using the command line. First, build the Unity project, then using the command “java -jar <path_to_sdk>\build-tools\(version)\lib\dx.jar --dex --output=<path_to_dex>\classes.dex <path_to_unity_project>\Temp\StagingArea\classes.jar

What Kind of Files can I Convert into Dex Format in Unity?

You can convert classes written in C++, C#, and other languages into Dex format.

What is IL2CPP?

IL2CPP is the Unity scripting backend that enables the development of applications for certain platforms. It is used to convert managed code such as C#, into native code.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.