SecurityException: Unable to find field for dex.ja

2020-06-05 18:59发布

问题:

Yesterday evening I upgrade to ADT-21 and restarted eclipse. Then eclipse said that you need to update android tool to version 21. I downloaded window_installer21 and install it in the same location where my previous window_installer was installed. So it overwrite the file. Then I restarted eclipse and suddenly all project stop working. Eclipse always open with the error. SecurityException: Unable to find field for dex.jar

And when i try to launch a project it stops with the below error Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!

SDK Manager is also not opening.

I have tried:

  1. Clearing all project
  2. Re stared eclipse and computer about 20-30 timmes
  3. Uninstall Android SDk, JAVA and reinstalled it
  4. Setting the path of find_java.bat file
  5. Searched 6 hour over internet and read some form

This, this.and this one also.

Nothing seems to work.

回答1:

A popup appears warning you to update to the latest sdk and opens the appropriate tool. Tried this (several times - restarting each time) with no effect.

Instead the answer was ..

  1. In eclispe, find the location of your android sdk (Window->Preferences->Android and the SDK location is at the top of the page).

  2. Close down eclispe.

  3. Find the sdk on the disk - and run the standalone SDK Manager.exe (It appears to fail when first opened - but wait a second or two for the gui to appear). Note - this is the same gui that was previously opened by eclipse!

  4. Take all the updates as recommended. A dialog box appears indicating that the management tool itself has been updated and should be restarted.

  5. Restart the tool - take any more updates recommended and close.

  6. Start eclipse - the problem has gone away!



回答2:

try to install fresh andoridSDK. the problem is with SDK and not with your eclipse.



回答3:

Update your Android tool/sdk with latest and create new workspace .it solved problem for me



回答4:

I you got the same error message, but SDK manager works for you, run it with administrator privileges and delete both packages in Tools folder. Then install them again.



回答5:

I was having a similar problem after installing the latest Android/Eclipse direct from the Android developer site. I was also seeing another error related to find_java claiming it couldn't find Java in c:\windows\system32\java.exe. I had previously used MOTODEV studio a year ago (haven't touched it since). I was concerned it might cause a conflict, so I uninstalled it. However it left some bits and pieces in my c:\Users\ folder. I blew away some hidden directories related to android, as well as an androidsdks directory that had been installed there and likewise blew away my workspace folder. Then I launched Eclipse/SDK Manager and all was right with the world :)



回答6:

Since I got this issue I started using Google ADT Bundle from http://developer.android.com/sdk/index.html
Everything is fine now.



回答7:

  • Update Eclipse Packages: Help > Check for Updates
  • Update Android SDK: Window > Android SDK Manager


回答8:

This is caused by the existence of an older version of dx.jar in the VirtualStore (a folder where windows stores user versions of system and program files). Go to "C:\Users\<your user name>\AppData\Local\VirtualStore\<android-sdk path>" and delete all the content, or just the "\platform-tools\lib\dx.jar" file.

i.e: if your user name is "user32" and your android SDK is placed in "C:\Program Files\Java\android-sdk", after the update you'll probably have an obsolete version of dx.jar in "C:\Users\user32\AppData\Local\VirtualStore\Program Files\Java\android-sdk\platform-tools\lib\"



回答9:

If the .jar file could not load try this..

locate android-sdks\build-tools\28.0.3\lib

delete the dx.jar file

Select the appropriate sdk tools that your android application works with thorugh sdk manager

Again search for

Here i am using apk 21.0.1

locate android-sdks\build-tools\21.0.1\lib

Cut the dx.jar file and paste it in the android-sdks\build-tools\28.0.3\lib folder