不使用默认邮件应用程序,只需点击一个按钮,我就可以从我的应用程序发送邮件。
我点了这个链接:
Sending Email in Android using JavaMail API without using the default/built-in app
添加了对mainfest文件的权限,但仍无效。 请帮助。
当我在我的设备上打开它时,app force会关闭。
我的logcat文件显示为:
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): FATAL EXCEPTION: main
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.mailsend/org.mailsend.MailSenderActivity.java}: java.lang.ClassNotFoundException: org.mailsend.MailSenderActivity.java in loader dalvik.system.PathClassLoader[/mnt/asec/org.mailsend-2/pkg.apk]
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1743)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at android.app.ActivityThread.access$1500(ActivityThread.java:132)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at android.os.Looper.loop(Looper.java:143)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at android.app.ActivityThread.main(ActivityThread.java:4277)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at java.lang.reflect.Method.invokeNative(Native Method)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at java.lang.reflect.Method.invoke(Method.java:507)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at dalvik.system.NativeStart.main(Native Method)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): Caused by: java.lang.ClassNotFoundException: org.mailsend.MailSenderActivity.java in loader dalvik.system.PathClassLoader[/mnt/asec/org.mailsend-2/pkg.apk]
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1735)
08-23 15:10:26.126: ERROR/AndroidRuntime(18094): ... 11 more
我使用的代码与中的代码相同 Sending Email in Android using JavaMail API without using the default/built-in app
这是我的主要节日:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mailsend"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="preferExternal" >
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
<activity android:name=".MailSenderActivity.java"
android:label="@string/app_name">
<activity android:name=".GMailSender"></activity>
<activity android:name=".MailSenderActivity"></activity>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
答案 0 :(得分:0)
您错过了APK文件中的org.mailsend.MailSenderActivity
课程,因此无法启动。将此类添加到您的APK文件或修改清单不包含它(并且不要尝试启动它)。
答案 1 :(得分:0)
检查GMailSender.java文件中的包名称
static {
Security.addProvider(new PACKED-NAME.JSSEProvider());
}
在JSSEProvider文件中添加代码
public final class JSSEProvider extends Provider {
private static final long serialVersionUID = 1L; ---> this code is add