HarishBS / voicemail-example-for-android

Automatically exported from code.google.com/p/voicemail-example-for-android
0 stars 0 forks source link

NetworkOnMainThreadException on Greeting upload #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run application
2. Click Upload Greeting button
3. Shows NetworkOnMainThreadException

What is the expected output? What do you see instead?
Try uploading w/o exception

What version of the product are you using? On what operating system?
4.0.3 and 4.0.4

Please provide any additional information below.
This is because IMAP open operation is performing on UI thread.
FetchVoicemailPresenter.put() should not be there as the creator left the 
comment.

04-26 20:24:32.945: E/AndroidRuntime(3534): FATAL EXCEPTION: main
04-26 20:24:32.945: E/AndroidRuntime(3534): 
android.os.NetworkOnMainThreadException
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1084)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
java.net.InetAddress.lookupHostByName(InetAddress.java:391)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
java.net.InetAddress.getByName(InetAddress.java:295)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
java.net.InetSocketAddress.<init>(InetSocketAddress.java:105)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
java.net.InetSocketAddress.<init>(InetSocketAddress.java:90)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
com.android.email.mail.transport.MailTransport.open(MailTransport.java:158)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
com.android.email.mail.store.ImapStore$ImapConnection.open(ImapStore.java:1414)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
com.android.email.mail.store.ImapStore$ImapConnection.sendCommand(ImapStore.java
:1563)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
com.android.email.mail.store.ImapStore$ImapConnection.executeCommandWithResponse
(ImapStore.java:1588)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
com.android.email.mail.store.ImapStore$ImapConnection.executeSimpleCommand(ImapS
tore.java:1578)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
com.android.email.mail.store.ImapStore$ImapConnection.executeSimpleCommand(ImapS
tore.java:1573)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
com.android.email.mail.store.ImapStore$ImapFolder.open(ImapStore.java:555)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
com.google.android.voicemail.example.activity.fetch.FetchVoicemailPresenter.put(
FetchVoicemailPresenter.java:116)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
com.google.android.voicemail.example.activity.fetch.FetchVoicemailPresenter$Uplo
adButtonListener.onClick(FetchVoicemailPresenter.java:220)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
android.view.View.performClick(View.java:3480)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
android.view.View$PerformClick.run(View.java:13983)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
android.os.Handler.handleCallback(Handler.java:605)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
android.os.Handler.dispatchMessage(Handler.java:92)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
android.os.Looper.loop(Looper.java:137)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
android.app.ActivityThread.main(ActivityThread.java:4340)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
java.lang.reflect.Method.invokeNative(Native Method)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
java.lang.reflect.Method.invoke(Method.java:511)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-26 20:24:32.945: E/AndroidRuntime(3534):     at 
dalvik.system.NativeStart.main(Native Method)

Original issue reported on code.google.com by ws.ben....@gmail.com on 26 Apr 2012 at 12:02