68

I just downloaded Eclipse Galileo and installed ADT10 and tried to a phonegap app using this guide: http://www.phonegap.com/start But each time i try to build im getting this error: Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!

I know that there are already some questions/answers about it in this forum but they didnt work for me.

Adonis K. Kakoulidis
  • 4,466
  • 5
  • 29
  • 41

17 Answers17

92

This is caused by incomplete/messy upgrade to latest version which results in dx.jar missing from {Android SDK dir}\platform-tools\lib\.

Solution:

Find your latest dx.jar in {Android SDK dir}\platforms\*

and copy it to:

{Android SDK dir}\platform-tools\lib\

Restart eclipse, clean your project and everything should work as expected.

(If platform-tools\lib directory is missing entirely you will have to reinstall "Android SDK platform-tools" using SDK manager. After reinstall dx.jar should be in there so no copying will be needed)

If you can't find dx.jar in any of {Android SDK dir}\platforms\* subdirs you will have to start SDK manager and install Android 1.6 SDK.

For example on my machine latest was in {Android SDK dir}\platforms\android-4\tools\lib\. (I did not find any newer version as of 2012-01-22 Android SDK R15).

I really hope that this is useful for someone because I've wasted half a day investigating and looking for solution of such a trivial bug... :-(

Ognyan
  • 12,916
  • 4
  • 61
  • 73
  • Backup your original dx.jar file before making it - this solution totally broke my eclipse installation and now I will have to reinstall the whole eclipse and android environment, because of this comment that is upvoted by 39 people! – luben Jan 30 '13 at 09:13
  • @Lyuben Probably you did overwrite some other file(s)? If you already had dx.jar you will not get the "dx.jar was not loaded from the SDK folder" in the first place... – Ognyan Jan 30 '13 at 12:17
  • 2
    The problem happened, because I had 2 different eclipse IDEs - Juno & Indigo. The Juno was working fine, however Indigo showed me this error with the dx.jar file. Then I copied the dx.jar as is adviced here and the Indigo eclipse was still not working. However, the Juno eclipse also stopped working at that moment :) The solution was to uninstall the ADT plugin from eclipse and download fresh new SDK and install the plugin again and point it to the new SDK directory. My first mistake was forgetting to backup the dx.jar file before copying and overwriting it. – luben Jan 30 '13 at 12:36
  • 1
    I see. Well, that is quite unfortunate. I will +1 your second comment in order to give some heads up to people in similar situation (i.e. 2xEclipses). – Ognyan Jan 30 '13 at 14:25
  • I first ran into this issue when I updated Eclipse. The upgrade of Eclipse caused me to be incompatible with the SDK that I had installed. So, my next step was to download the latest release of the SDK and to install it. Installation of the SDK alone was not enough. I then had to run the Android SDK Manager, and allow it to upgrade all that it felt was necessary. Once that was done, I continued to see this issue. The last step was to restart Eclipse, and finally, the mess of errors were gone. – BluJ IT Feb 09 '13 at 06:44
  • 1
    This is where I can find the dx.jar file: C:\Users\Jaime\android-sdks\build-tools\26.0.0-preview\lib\dx.jar. I know when I try to Run the project, it is trying to find dx.jar in the location where I have it. The problem is that for some reason, it is always failing to load it. I keep getting this error: "Dex Loader] Failed to load C:\Users\Jaime\android-sdks\build-tools\26.0.0-preview\lib\dx.jar". I already tried from two different computers and the error is exactly the same. Any ideas? – Jaime Montoya Mar 26 '17 at 04:18
  • 1
    @JaimeMontoya I had a similar problem. I wound up just deleting the 26.0.0-preview directory completely since I was building with a different Android version anyways. That worked but I'm not sure I'd recommend that method. – FCo Mar 30 '17 at 16:04
  • That sounds smart and I guess it should not break anything because as you said, you were not using that directory. I posted my solution at http://stackoverflow.com/questions/43009679/unknown-error-unable-to-build-the-file-dx-jar-was-not-loaded-from-the-sdk-fold/43040723#43040723, but in the first comment I also wrote for the accepted answer, you can see how that solution did not immediately work for me when I tried on another PC, so I am not sure if what helped to solve the problem really was switching down from Java 8/compiler compliance level 1.8 to Java 7/compiler compliance level 1.7. – Jaime Montoya Mar 30 '17 at 16:16
  • Nothing I've tried is working for me. I don't have a working SDK Manager, other than using Android Studio to install the sdk tools and the platorm sdks. Android Studio doesn't understand my old eclipse project and I know nothing about gradle so I gotta use eclipse with ADT - which won't work because of this dx.jar issue. Any further ideas on where to get the proper dx.jar? I've tried uninstalling the sdk tools and platform tools from within Android studio and re-install but it doesn't help. – Skychan Oct 12 '18 at 05:50
39

platform-tools\lib folder was missing after upgrade (my eclipse was open). close eclipse, using sdk manager uninstall and install "Android SDK platform-tools".

fredy
  • 545
  • 2
  • 7
  • 19
38

I just encountered the same problem yesterday, in Eclipse of Neon Release (4.6.0).

It's a compatible issue related to 26.0.0 of android-sdk "build-tools".

Simple Solution:

  • Delete "26.0.0" in "build-tools" directory
  • Use "25.0.2" instead
  • Restart eclipse

Other Solution:

  • add this in the project.properties of your project:
    sdk.buildtools=25.0.2

Good luck!

Randy
  • 3
  • 2
Verdigrass
  • 1,123
  • 11
  • 14
  • @Verdigrass Is this different to my proposed solution? – rsp1984 Aug 29 '17 at 17:08
  • @rsp1984 It is similar but in different versions and platforms. – Verdigrass Sep 04 '17 at 01:28
  • 1
    You don't need to delete any build-tools (you can have multiple versions) for each target version you want to support. You can install build-tools 25.0.3 using `ANDROID_SDK\tools\bin\sdkmanager.bat --install build-tools;25.0.3` - if you're targeting API 25 that is. – Dan Dar3 Nov 27 '17 at 21:49
  • Keep in mind the date youre having this issue!!! Previous high voted answers dont work anymore! This solution worked for me after hours!! I'm currently using now Java JDE 8.x (I had 9 but reverted; not sure if necessary now but worth mentioning). *Make sure you exit out of Eclipse->Use SDK Manager to uninstall->Physically delete any remaining folders – Kevin Feb 12 '18 at 04:23
  • I keep forgetting not to delete 25.0.3 and I always find this answer back :) – Tom Mar 28 '19 at 20:50
  • @Tom Keep forgetting it and use Android Studio instead. :) – Verdigrass Apr 12 '19 at 03:02
  • @ Verdigrass, yep I just did that. It works great. I dunno why it took me so long to do the switch :D – Tom Apr 12 '19 at 12:23
10

I had this problem in Eclipse since I upgraded from build-tools 25.0.0 to 26.0.0

I just add "sdk.buildtools=25.0.0" in my project.properties and it works again

my project.properties:

target=android-23
sdk.buildtools=25.0.0
android.library.reference.1=../design
Chet
  • 18,801
  • 10
  • 35
  • 57
Elyas Nategh
  • 472
  • 4
  • 4
  • 1
    You can have as many build-tools installed at the same time, for each target version you want to support. You can install 25.0.3 using `ANDROID_SDK\tools\bin\sdkmanager.bat --install build-tools;25.0.3` – Dan Dar3 Nov 27 '17 at 21:48
  • 1
    Thanks, its really worked for my old code with old cordova version. – Prasad Feb 15 '18 at 13:44
9

I was running Eclipse Neon.2 and the Android SDK Build-tools + platform-tools version 26 on Mac OS 10.12.4 and none of the above answers (including the accepted answer) worked for me.

What did work was to

  1. Quit Eclipse

  2. Remove the folder <android-sdk>/build-tools/26.0.0 and to install the (older) version 25.0.3 of the build tools through the Android SDK manager.

  3. Start Eclipse again

rsp1984
  • 1,777
  • 19
  • 22
  • 1
    I'm on Windows 10 using neon.3 and this was it for me. Thanks! – Dave Jun 22 '17 at 15:47
  • Was inspecting old Eclipse Juno projects on a newer Windows PC, this solution actually worked. Is it just missing from the current build-tools I guess? – cgv Sep 11 '17 at 15:35
4

It happened to me, either, and it happens because I've changed to win7, and install the latest ADT to eclipse, but I used my old Android SDK. Finally, I fix this problem by updating my Android SDK to the latest version.

Dr.Agon
  • 51
  • 4
4

For me, eclipse was looking in the wrong place for the SDK Manager. To fix this I did

  • Window/ Preferences/ Android/ SDK Location

NOTE: The SDK manager tells you what dir it is using near the top of the UI.

I had installed a new version of eclipse that has the ADT bundled up from the Android developer site, but when I opened eclipse it was looking at the old SDK.exe location.

hth

pdschuller
  • 518
  • 6
  • 24
3

sometimes you need just to restart Eclipse after the update, it worked for me to fix that error

Alamri
  • 1,852
  • 1
  • 14
  • 20
3

Also, make sure that the version of the ADT is supported by the AndroidSDKTools. That fixed my problem. In the SDK Manager, File->Reload will lead to the latest revisions.

Clocker
  • 1,016
  • 1
  • 16
  • 28
3

I haven't seen this specific problem, but you may get better results with Eclipse Helios or Indigo. Galileo is getting old and is unlikely to be tested as much as the more recent Eclipse platforms.

Paul Beusterien
  • 21,795
  • 5
  • 61
  • 115
2

Windows 7 64 bit, Intel i7

This happened to me as well after I updated the SDK to be Jelly Bean compatible. The folder platform-tools\lib was gone. I also wasn't able to uninstall/reinstall the program-tools in the SDK manager at first. It gave me the error that a particular file in the android\temp folder was not there. I had to change the permissions on the android folder to allow every action, and that solved it.

Katamaritaco
  • 295
  • 4
  • 12
2

Even after reinstalling "Android SDK platform-tools" in my UBuntu-16.04 LTS problem persisted. I am using Eclipse-Oxygen. Copying dx.jar from /build-tools/25.0.3/lib into /build-tools/26.0.0-preview/lib solved my problem.

Rahul Agrawal
  • 519
  • 1
  • 3
  • 17
2

Try using Eclipse Indigo: http://www.eclipse.org/downloads/ and follow the instructions on how to install Android ADT from: http://developer.android.com/sdk/eclipse-adt.html

Nixr Systems
  • 77
  • 2
  • 9
1

Updating Android SDK platform-tools with the Android SDK Manager and restarting Eclipse did it for me

Babatunde Adeyemi
  • 13,567
  • 3
  • 31
  • 25
1

If you have updated the ADT tools and also SDK platform and you see the above error, restart Eclipse.

coredump
  • 704
  • 1
  • 6
  • 16
0

Unzip the updated Android SDK in your current SDK folder. This solved my problem.

Jon7
  • 7,005
  • 2
  • 31
  • 39
Lucas
  • 1,134
  • 2
  • 13
  • 19
0

It's work for me do this

Delete "26.0.0" in "build-tools" directory Use "25.0.2" instead Restart eclipse

Android
  • 1,358
  • 4
  • 10
  • 22
brite
  • 17
  • 7