Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio javax.mail jar build error

Tags:

android

email

I'm trying to use the Gmail API to send emails. I've followed the Google documentation on how to do this. I need access to MimeMessage which is from the import:

javax.mail.internet.MimeMessage;

Since this is not included by default in Android Studio I downloaded the .jar files and did.

File -> New -> New Module -> Import .JAR

I also physically placed the javax.jar in the libs folder in Android Studio and referenced the jar from there.

my build.gradle(app) file looks like this in the dependencies section:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.google.android.gms:play-services:7.3.0'
    compile 'com.google.api-client:google-api-client:1.20.0'
    compile 'com.google.api-client:google-api-client-android:1.20.0'
    compile 'com.google.api-client:google-api-client-gson:1.20.0'
    compile 'com.google.apis:google-api-services-gmail:v1-rev29-1.20.0'
    compile project(':javax.mail')
}

However when I clean and build the project I get this error:

com.android.ide.common.ProcessException: org.gradle.Internal.ExecException.

I googled this and I'm pretty sure it has to do with my .jar file reference but I'm not sure how to fix this.

like image 884
zic10 Avatar asked Jun 12 '15 15:06

zic10


1 Answers

Add this to your dependencies section:

compile  'javax.mail:javax.mail-api:1.5.3'
like image 146
Sestertius Avatar answered Nov 15 '22 07:11

Sestertius