What is dx.jar in the Android SDKs?

14,906

Solution 1

Additional to CommonsWare's comment.

The dx.jar was original located under android-sdk/platforms/android-X/tools/lib/ before (especially in android-3 and android-4), and moved to android-sdk/platform-tools/lib/ later. Unfortunately this has never documented in any official source, probably because it is part of internal tools which Google doesn't want to consumer developer to be bothered. check out this blog to see the problem.

As long as you follow Android installation guide and add android-sdk/tools/ and android-sdk/platform-tools/ to your PATH environment variable, you should be fine to access dx.jar, unless you use a really old Android SDK version (I doubt that).

Last, as a quick reference, this is command how SDK typically use dx.jar to dex you java bytecode with external jar libraries:

[INFO] C:\Program Files\Java\jdk1.6.0_21\jre\bin\java [-Xmx1024M, -jar, C:\Program Files\Android\android-sdk\platform-tools\lib\dx.jar, --dex, --output=C:\workspace\myproject\target\classes.dex, C:\workspace\myproject\target\classes, C:\workspace\myprojec\libs\common-lib.jar, ... ...]

Solution 2

Currently, dx.jar has been moved to

adt-bundle-*\sdk\build-tools\17.0.0\lib

You can find the source code of dx here.

Share:
14,906
user604713
Author by

user604713

Updated on July 25, 2022

Comments

  • user604713
    user604713 almost 2 years

    What is the purpose of the dx.jar file that I see in some of Android SDK versions that I've installed with the Android SDK manager; the file appears under tools/lib/dx.jar I do NOT see the file in versions above android-8 and above. However Intellij IDEA gives an error when I try to build a project with android-8 and above, saying that dx.jar doesn't exist. What gives?

    Thanks, Tom

  • yorkw
    yorkw about 12 years
    dx is just a shell script used to run the lib/dx.jar.