我已经读过这个帖子Link
我正在使用此主题中描述的类似结构
我拿了三个罐子(邮件,激活,附加)并将GMailSender.java和JSEEProvider.java添加到我的项目中。
我这样做时会出现以下错误:
08-23 19:06:42.661 7671-7671/? E/dalvikvm﹕ Could not find class 'android.app.job.JobScheduler', referenced from method com.android.email.service.s.a
08-23 19:06:42.661 7671-7671/? E/dalvikvm﹕ Could not find class 'android.app.job.JobScheduler', referenced from method com.android.email.service.s.b
08-23 19:06:43.081 7671-7721/? E/Gmail﹕ Error finding the version of the Email provider.....
android.content.pm.PackageManager$NameNotFoundException: com.google.android.email
at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:103)
at com.google.android.gm.EmailMigrationService.a(SourceFile:1279)
at com.google.android.gm.EmailMigrationService.onHandleIntent(SourceFile:219)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:61)
主要活动中的代码如下所示:
GMailSender sender = new GMailSender(TagClass.DEVELOPER_EMAIL, TagClass.DEVELOPER_PASSWORD);
sender.sendMail(TagClass.FORGOT_CREDENTIALS_SUBJECT,
"Hi" + fullName + "\n\n" + TagClass.FORGOT_CREDENTIALS_BODY_USER + arrayListUsernamePassword.get(0)
+ "\n" + TagClass.FORGOT_CREDENTIALS_BODY_PASSWORD + arrayListUsernamePassword.get(1) +
TagClass.FORGOT_CREDENTIALS_BODY_ENDING, TagClass.DEVELOPER_EMAIL,emailAddress );
我在Async Task中发送邮件,并且还为我的清单添加了互联网权限,我使用的所有凭据都是正确的。