ERROR: Ill-advised or mistaken usage of a core class (java.* or javax.*)


I imported a project from Eclipse, and, after some trials, am trying to run it.  I now get the following error, and the answers I have found on Google require more IDIA knowledge then I have :(

Your help would be much appreciated:

Information:Compilation completed with 33 errors and 2 warnings
Information:33 errors
Information:2 warnings
Error:[Weathum] trouble processing "java/security/Provider.class":
Error:[Weathum] Ill-advised or mistaken usage of a core class (java.* or javax.*)
Error:[Weathum] when not building a core library.
Error:[Weathum] This is often due to inadvertently including a core library file
Error:[Weathum] in your application's project, when using an IDE (such as
Error:[Weathum] Eclipse). If you are sure you're not intentionally defining a
Error:[Weathum] core class, then this is the most likely explanation of what's
Error:[Weathum] going on.
Error:[Weathum] However, you might actually be trying to define a class in a core
Error:[Weathum] namespace, the source of which you may have taken, for example,
Error:[Weathum] from a non-Android virtual machine project. This will most
Error:[Weathum] assuredly not work. At a minimum, it jeopardizes the
Error:[Weathum] compatibility of your app with future versions of the platform.
Error:[Weathum] It is also often of questionable legality.
Error:[Weathum] If you really intend to build a core library -- which is only
Error:[Weathum] appropriate as part of creating a full virtual machine
Error:[Weathum] distribution, as opposed to compiling an application -- then use
Error:[Weathum] the "--core-library" option to suppress this error message.
Error:[Weathum] If you go ahead and use "--core-library" but are in fact
Error:[Weathum] building an application, then be forewarned that your application
Error:[Weathum] will still fail to build or run, at some point. Please be
Error:[Weathum] prepared for angry customers who find, for example, that your
Error:[Weathum] application ceases to function once they upgrade their operating
Error:[Weathum] system. You will be to blame for this problem.
Error:[Weathum] If you are legitimately using some code that happens to be in a
Error:[Weathum] core package, then the easiest safe alternative you have is to
Error:[Weathum] repackage that code. That is, move the classes in question into
Error:[Weathum] your own package namespace. This means that they will never be in
Error:[Weathum] conflict with core system classes. JarJar is a tool that may help
Error:[Weathum] you in this endeavor. If you find that you cannot do this, then
Error:[Weathum] that is an indication that the path you are on will ultimately
Error:[Weathum] lead to pain, suffering, grief, and lamentation.
Error:[Weathum] 1 error; aborting
    Warning:Warning:line (37)[deprecation] instantiateItem(View,int) in PagerAdapter has been deprecated
    Warning:Warning:line (72)[deprecation] destroyItem(View,int,Object) in PagerAdapter has been deprecated

I assume the lines I have graed out are not part of the problem.

Many Thanks,

Brett Nieland
Comment actions Permalink

It sounds like an Eclipse jar got included with the dependencies when importing the project. In IDEA go to File > Project Structure. Click on the libraries node on the left. Scan through the list of libraries and look for something that is likely from eclipse and remove it. (You may also have to remove it from the dependencies tab for the module(s) that use it. I can't remember off the top of my head if IDEA alerts you to such or not.) Then try compiling. You may fail on a package does not exist or cannot find symbol error. You need to go to the class that reports that problem and remove the use of the core class from it.

Comment actions Permalink


I resolved this by using the "Create From" instead of the "Import From" process in IDEA, so I can not test your answer.  I do thank you for your time, and I suspect that someone else will need this info in the future.




Please sign in to leave a comment.