Skip to content Skip to sidebar Skip to footer

Android Studio: Noclassdeffounderror

I'm trying to build an app that sends an email using javamail and gmail's smtp service, but when I run it it crashes when I call Session.getInstance. After debugging it appears tha

Solution 1:

Not sure if you solved this already, but I found you need to use an Android specific Java Mail library.

compile'com.sun.mail:android-mail:1.5.5'compile'com.sun.mail:android-activation:1.5.5'

I was running into your error and other similar ones using the latest Java Mail libraries but switching to these fixed all of them.

https://java.net/projects/javamail/pages/Android

Solution 2:

In Module Settings, Dependencies, make sure libs is set to "Compile"

enter image description here

Post a Comment for "Android Studio: Noclassdeffounderror"