title: Sending automated email issues Android
body: <p>I'm trying to write an app that will send an automated email from a button push in an Android application.</p>
  
  <p>I realize this question has been asked multiple times, but I still have not found a final solution for it for my case.</p>
  
  <p>The code example I followed came from here:</p>
  
  <p><a href="http://macmaker.blogspot.com/2012/04/send-emails-in-background-in.html" rel="nofollow noreferrer">http://macmaker.blogspot.com/2012/04/send-emails-in-background-in.html</a></p>
  
  <p>The GMailSender class is exactly the same. So is the MainActivity class except I use my own email to test that it is sending properly.</p>
  
  <p>The two main questions I have looked at are the following:</p>
  
  <p><a href="https://stackoverflow.com/questions/26927225/android-sending-emails-java-lang-noclassdeffounderror-javax-activation-datahand][1]">Android sending emails java.lang.NoClassDefFoundError: javax.activation.DataHandler</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6368704/java-lang-noclassdeffounderror-javax-activation-datahandler-in-android">java.lang.NoClassDefFoundError: javax.activation.DataHandler in android</a></p>
  
  <p>I have all three files (activation.jar, additionnal.jar, mail.jar) put into my project as Modules. This was done by following the example in this YouTube video:</p>
  
  <p><a href="https://www.youtube.com/watch?v=dpuJPoXkFG4" rel="nofollow noreferrer">https://www.youtube.com/watch?v=dpuJPoXkFG4</a></p>
  
  <p>However, I still keep getting this error:</p>
  
  <pre><code>08-25 14:10:24.968  29531-29531/com.example.mailapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
  Process: com.example.mailapp, PID: 29531
  java.lang.NoClassDefFoundError: javax.activation.DataHandler
          at com.example.mailapp.GMail.send(GMail.java:103)
          at com.example.mailapp.MainActivity$1.onClick(MainActivity.java:33)
          at android.view.View.performClick(View.java:4780)
          at android.view.View$PerformClick.run(View.java:19866)
          at android.os.Handler.handleCallback(Handler.java:739)
          at android.os.Handler.dispatchMessage(Handler.java:95)
          at android.os.Looper.loop(Looper.java:135)
          at android.app.ActivityThread.main(ActivityThread.java:5254)
          at java.lang.reflect.Method.invoke(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:372)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
  </code></pre>
  
  <p>I'm not sure if the steps in the YouTube video I followed is the reason why it's not working properly or if there is something wrong with the code in general.</p>
  
  <p>If you have any suggestions please help.</p>
  
  <p><strong>EDIT:</strong> I also have attempted to place all of the .jar files in the libs folder and make sure that they are in the build.gradle file under dependencies as follows:</p>
  
  <pre><code>dependencies {
  compile fileTree(include: ['*.jar'], dir: 'libs')
  compile 'com.android.support:appcompat-v7:22.2.0'
  compile project(':activation')
  compile project(':additionnal')
  compile project(':mail')
  compile files('libs/activation.jar')
  compile files('libs/additionnal.jar')
  compile files('libs/mail.jar')
  }
  </code></pre>
  
  <p>I did this by looking at this question:</p>
  
  <p><a href="https://stackoverflow.com/questions/16608135/android-studio-add-jar-as-library?rq=1">Android Studio: Add jar as library?</a></p>
  
  <p>But the error still persists.</p>
  
  <p><strong>EDIT 2:</strong>
  When the .jar files are in my libs folder (and in the modules) I can find the DataHandler class. However, when I click on it to view it, a message at the top of the screen appears that says "Decompiled .class file, bytecode version: 48.0 (Java 1.4)"</p>
  
  <p>Not sure if that is useful to anyone on this site. Also, the file is locked as in I can't edit it which is what I would expect.</p>