简体   繁体   中英

NoClassDefFoundError javax.mail.internet.MimeBodyPart$MimePartDataHandler in Android

I'm getting NoClassDefFoundError in an Android app I'm writing. I added:

compile 'javax.mail:mail:1.4.7'

to my build.gradle. But I get a java.lang.NoClassDefFoundError exception trying to run this code:

MimeMessage email = new MimeMessage(session, new ByteArrayInputStream(decodedRawMessage));
                    Log.d(LOG_TAG, "Got mimeType: "+email.getContent());

The "email.getContent()" is the place where the exception is thrown. Is there a different version of javax.mail I should use?

Eventually I didn't use the 'compile' line in gradle. I added jars the old way in the libs folder and clicked 'Add as Library' from the right click menu in Android Studio. Jars can be downloaded from here

Need all 3 of them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM