I was wondering if someone could help me with debugging. I am currently using the code in:
Sending Email in Android using JavaMail API without using the default/built-in app
and have used all of the code as directed. After inputting my email fields, I was unable to get email to be sent. I noticed a piece of code in GMailSender.java, where it seemed that there was a missing piece of code.
}catch(Exception e){
}
Knowing that I had debugged every other part of the code, I added a Log.e, as so.
}catch(Exception e){
Log.e("GmailDebug", e.getMessage(), e);
}
As a result, I noticed that I got the following logs.
01-16 22:22:38.933: E/GmailDebug(4487): null
01-16 22:22:38.933: E/GmailDebug(4487): android.os.NetworkOnMainThreadException
After commenting out the lines beforehand and systematically uncommenting them, I finally was able to determine that I didn't get any logs until I uncommented the line
Transport.send(message);
Can someone help me out, and tell me how I can prevent these errors? Thanks!