Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is dx.jar in the Android SDKs?

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

like image 219
user604713 Avatar asked May 04 '12 21:05

user604713


2 Answers

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.

like image 158
Kiwi Avatar answered Sep 28 '22 15:09

Kiwi


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, ... ...]

like image 22
yorkw Avatar answered Sep 28 '22 17:09

yorkw