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.
Add this to your dependencies section:
compile 'javax.mail:javax.mail-api:1.5.3'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With