1

In my Android appliction in eclipse I get the following error:

[2011-11-03 19:39:12 - MiniPauker 1.0] Dx 
trouble processing "java/crcis/pauker/AddCardActivity$1.class":

Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.

However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.

If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.

If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.

If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.

[2011-11-03 19:39:12 - MiniPauker 1.0] Dx 1 error; aborting
[2011-11-03 19:39:12 - MiniPauker 1.0] Conversion to Dalvik format failed with error 1

this error only appears when run my project. I search long time to the right solution but all possible solutions don't work. I use android 4.0 and Eclipse 3.6,now

by the way, this project worked in Android 2.1 but in Android 4.0 No!!!

Omid Nazifi
  • 5,235
  • 8
  • 30
  • 56

4 Answers4

8

Your package name starts with java, which is reserved for core Java packages. You should rename your package if at all possible.

Brigham
  • 14,395
  • 3
  • 38
  • 48
3

I was getting this because I had manually added android.jar to the build libraries because it was saying it wasn't finding the android libraries. The fix was to...

  1. Remove android.jar from the build libraries

  2. Right click on the project, go to "Android Tools", and select "Fix Project Properties"

Hope this helps.

Gaʀʀʏ
  • 4,372
  • 3
  • 39
  • 59
  • Thanks, but I don't know remove android.jar from build libraries. and when I choice "Fix Project Properties", don't any happen! – Omid Nazifi Nov 21 '11 at 04:00
  • If you right click on your project, then go to "Java Build Path", then select "Libraries" tab, the Android libraries should be included (not simply "android.jar") I made the mistake of manually adding "android.jar" and it caused this problem. This view should include Android / Google API libraries (which include the jars in them). Hope this helps. – Gaʀʀʏ Nov 22 '11 at 03:34
  • In this situation, it might be that you are including a library/jar more than once, not necessarily the android.jar, but another. I'd check to make sure that isn't the case first. – Gaʀʀʏ Nov 22 '11 at 03:58
0

You have to check that your project (or dependencies libraries) doesn't contain android.jar in build path (Project>Properties>Java Build Path>Order and Export).

If your main project contains android.jar in Android Private Libraries then you have to check build path for all libraries which were added to your project and remove android.jar from build path.

0

Modify the error caused by the jar package's scope attribute, from compile-> provided, this operation can be modified in File-> Project Structure-> Dependencies or in the project view app folder in the build.gradle file there dependencies , The corresponding jar package compile modified like this: enter image description here

Et9
  • 389
  • 3
  • 7