Not able to include jndi.jar file in android project build path - android

I need to do LDAP authentication of my users in Android application , for the same I am using JNDI lookup method and need to include JNDI.jar in my build path , but android is not letting me do so and throwing the following error
[2011-02-17 15:08:33 - DHCAndroid]: Dx trouble processing
"javax/naming/AuthenticationException.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-02-17 15:08:33 - DHCAndroid]: Dx1 error; aborting [2011-02-17
15:08:33 - DHCAndroid] Conversion to Dalvik format failed with error 1
As soon as i remove the jar the error disappears, removing the jar is not an option , please help with the way to do it
Regards,
Smriti Garg

Find another LDAP library, then, one that is not in the javax namespace. What you want to do with this JAR is not possible.

Add the dex parameter --core-library to the [ANDROID_SDK]\platform-tools\dx.bat.
Change line ~59 of dx.bat: 'set params=' to 'set params=--core-library'
This enables the Android build process to allow including javax pacakges.

Like the error message says:
move the classes in question into your own package namespace.
[...] JarJar is a tool that may help you in this endeavor.
Repackage the JNDI code into your own namespace, by using JarJar. Then rely on your new jar instead.

Related

Android getting error when adding external custom library in eclipse

Why I'm getting below error when running the application? no error while building the app.
trouble processing "javax/security/cert/CertificateException.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.
[2015-01-15 18:24:25 - ProjectName] Dx 1 error; aborting
[2015-01-15 18:24:25 - ProjectName] Conversion to Dalvik format failed with error 1
You are attempting to add a java or javax class to your project. This is not supported in general.
In this specific case, you are attempting to add a javax class that already exists in Android. That is utterly pointless, as the copy in Android will trump whatever copy is in this library.
The library that you are trying to use is not designed for use on Android (and would be seriously suspect on regular Java), and it will require modification. You may be better served using another library.

how can i avoid Conversion to Dalvik format failed with error 1 Dx 1 error; to add external lib?

I'm using jaxb-api.jar library for soap xml to java object conversion. but I'm getting following issue. please some one help me to identify my mistake.
I GOT FOLLOWING MESSAGE FROM MY CONSOLE:
[2014-03-17 12:37:15 - RailwayApp] Dx
trouble processing "javax/xml/bind/annotation/adapters/CollapsedStringAdapter.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.
[2014-03-17 12:37:15 - RailwayApp] Dx 1 error; aborting
[2014-03-17 12:37:15 - RailwayApp] Conversion to Dalvik format failed with error 1
It's pretty tricky to get JAXB work on Android. See here

Conversion to Dalvik format failed with error 1 in android

[2012-05-24 15:44:34 - myproject] Dx
trouble processing "java/security/Provider.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.
[2012-05-24 15:44:34 - myproject] Dx 1 error; aborting
[2012-05-24 15:44:34 - myproject] Conversion to Dalvik format failed with error 1
I ran into the same error message when trying to build an android project. The reason was that I had added a copy of the android.jar file as a referenced library in the project settings. When I removed this reference the problem was gone.
Clean your project and then also check your all drawable names that they should be in small letter.

(Conversion to Dalvik format failed with error 1 ), None of the posted solutions is working for me

I tried most of the solutions posted in the net, but none of them resolved my problem to execute my andriod project.
tried solutions.
sol 1: clean & Rebuild the project after removing all the libraries.
sol 2: updating proguard folder into the android sdk.
Could any one look into this and send me the appropriate solution, why dex is unable to convert this exception class. Is there any alternative way
Error is...
[2011-11-09 17:42:15 - RcsCoreSettings] Dx
trouble processing "javax/sip/TransactionDoesNotExistException.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-09 17:42:15 - RcsCoreSettings] Dx 1 error; aborting
[2011-11-09 17:42:15 - RcsCoreSettings] Conversion to Dalvik format failed with error 1

Conversion to Dalvik format failed with error 1 error. What i can do?

when i add a webservice client on my eclipse project, the console show me the bottom text. What i can do to solve this problem? thanks
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-05-10 14:33:09 - BPass Webservice Test] Dx 1 error; aborting
[2011-05-10 14:33:09 - BPass Webservice Test] Conversion to Dalvik format failed with error 1
You need to configure Eclipse to pass the --core-library flag when it calls dx. This Javax packages page describes how to do this if you're using ant to build your Android project.

Categories

Resources