不使用默認郵件應用程序,只需單擊一個按鈕,我想從我的應用程序發送郵件。在沒有用戶介入的情況下發送電子郵件android
我跟着這個鏈接:
Sending Email in Android using JavaMail API without using the default/built-in app
添加權限的mainfest文件,仍然是其無法正常工作。 和藹可親。
當我在設備上打開它時,應用程序強制關閉。
我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
這是我mainfest:
<?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>
能做到的android ** **那?它可以發送給你,還是隻是決定從你的存儲卡發回隨機的東西回到本壘?聽起來含糊不清。 – Paul
請更具體一些,發佈錯誤的logcat,發佈無法正常工作的代碼。幫助人們幫助您 – Egor
@ user838522 LogCat中的錯誤是什麼? – Blundell