You are trying to use classes that the Android platform simply doesn't
support (see the nice error message - in this case it's very
informative). In your case "javax.naming" from JNDI which is a core
class is not present, but regardless, not every java library runs or
is supported on Android (not everything that runs in a "standalone
application" which probably means desktop or server VM).

If you want to send email you might want to consider using an Intent
and going through the mailer UI so the user knows what's happening, or
if you want to do it programmatically it's purported that JavaMail
works without any porting (to use commons-email you will have to port
the parts Android doesn't support, that is, modify it to work with
Android).

See this thread for more info:
http://groups.google.com/group/android-developers/browse_thread/thread/c58d75c1ccfe598b/


On Sep 16, 8:15 am, Isuru danagalle <iisuru....@gmail.com> wrote:
> Hi All,
>            I am trying a simple send mail application using apache commons
> library.Here is the code.
>
> The email sending code is working fine in a standalone application.However
> when I try to run it as android application
>
> it gave following error message.
>
> trouble processing "javax/naming/AuthenticationException.class":
>
> [2009-09-17 05:33:20 - Commons]
>
> Attempt to include a core VM class in something other than a core library.
>
> It is likely that you have attempted to include the core library from a
> desktop
>
> virtual machine into an application, which will most assuredly not work. If
>
> you really intend to build a core library -- which is only appropriate as
>
> part of creating a full virtual machine binary, 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 please be aware that your build will still fail at some
>
> point; you will simply be denied the pleasure of reading this helpful error
>
> message.
>
> [2009-09-17 05:33:20 - Commons] 1 error; aborting
>
> [2009-09-17 05:33:20 - Commons] Conversion to Dalvik format failed with
> error 1
>
> I have added mail.jar,commons jars and jndi.jar to the references of eclipse
>
> If anybody know a resolution please let me know.
>
>  *public* *void* onClick(View view) {
>
>  String[] recipients = {recei...@gmail.com};
>
> SimpleEmail email = *new* SimpleEmail();
>
> email.addTo("sam...@gmail.com", "John Doe");
>
> email.addTo("sam...@gmail.com", "John Doe");
>
> email.setAuthentication("andr...@gmail.com", "android");
>
> email.setHostName("smtp.gmail.com");
>
> email.setDebug(*true*);
>
> email.setSmtpPort(465);
>
> email.setSSL(*true*);
>
> *for* (*int* i = 0; i < recipients.length; i++)
>
> {
>
> email.addTo(recipients[i]);
>
> }
>
> email.setFrom("sen...@gmail.com", "Me");
>
> email.setSubject("Test message");
>
> email.setMsg("This is a simple test of commons-email");
>
> email.send();
>
> Thanks & Regards,
>
> Isuru
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to