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


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 FilesJavajdk1.6.0_21jrebinjava [-Xmx1024M, -jar, C:Program FilesAndroidandroid-sdkplatform-toolslibdx.jar, --dex, --output=C:workspacemyprojecttargetclasses.dex, C:workspacemyprojecttargetclasses, C:workspacemyprojeclibscommon-lib.jar, ... ...]


Currently, dx.jar has been moved to

adt-bundle-*sdkbuild-tools17.0.0lib

You can find the source code of dx here.


For some reason I do see several versions (different size files) of dx and dx.jar in the various android sdk version subdirectories. I had been managing the SDKs through Eclipse, which a few months ago changed in this regard (now with a separate SDK Manager window) - so perhaps things got screwed up somehow in that transition process...

链接地址: http://www.djcxy.com/p/63514.html

上一篇: 文件dx.jar未从SDK文件夹加载

下一篇: 什么是Android SDK中的dx.jar?