Android emulator and device freezes on startup every now and then

You must Login before you can answer or comment on any questions.

Hello,

I made a small application for Android (2.2). It works fine, but every now and then it freezes on the splash screen and I have to restart it in order to work. It usually starts up regularly and only sometimes freezes so I can't quite find out where the problem is.

Here is the error log:

[INFO][TiApplication( 1721)] (main) [0,0] checkpoint, app created.
[INFO][TiApplication( 1721)] (main) [366,366] Titanium 2.1.1 (2012/07/27 14:01 0fd84a2)
[INFO][TiApplication( 1721)] (main) [17,704] Titanium Javascript runtime: v8
[WARN][TiBaseActivity( 1721)] (main) [65,769] Unsupported, out-of-order activity creation. Finishing.
[WARN][TiApplication( 1721)] (main) [1,770] Scheduling application restart
[WARN][InputManagerService(   60)] Got RemoteException sending setActive(false) notification to pid 1693 uid 10040
[INFO][ActivityManager(   60)] Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.my.project/.MyProjectActivity }
[WARN][InputManagerService(   60)] Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44eef238
[INFO][ActivityManager(   60)] Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x4 cmp=com.my.project/.MyProjectActivity (has extras) }
[WARN][ActivityManager(   60)] startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x4 cmp=com.my.project/.MyProjectActivity (has extras) }
[WARN][dalvikvm( 1721)] threadid=1: thread exiting with uncaught exception (group=0x4001d800)
[ERROR][TiApplication( 1721)] (main) [1270,2040] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to destroy activity {com.my.project/com.my.project.MyProjectActivity}: java.lang.NullPointerException; Titanium 2.1.1,2012/07/27 14:01,0fd84a2
[ERROR][TiApplication( 1721)] java.lang.RuntimeException: Unable to destroy activity {com.my.project/com.my.project.MyProjectActivity}: java.lang.NullPointerException
[ERROR][TiApplication( 1721)]   at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3655)
[ERROR][TiApplication( 1721)]   at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3673)
[ERROR][TiApplication( 1721)]   at android.app.ActivityThread.access$2900(ActivityThread.java:125)
[ERROR][TiApplication( 1721)]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
[ERROR][TiApplication( 1721)]   at android.os.Handler.dispatchMessage(Handler.java:99)
[ERROR][TiApplication( 1721)]   at android.os.Looper.loop(Looper.java:123)
[ERROR][TiApplication( 1721)]   at android.app.ActivityThread.main(ActivityThread.java:4627)
[ERROR][TiApplication( 1721)]   at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][TiApplication( 1721)]   at java.lang.reflect.Method.invoke(Method.java:521)
[ERROR][TiApplication( 1721)]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
[ERROR][TiApplication( 1721)]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
[ERROR][TiApplication( 1721)]   at dalvik.system.NativeStart.main(Native Method)
[ERROR][TiApplication( 1721)] Caused by: java.lang.NullPointerException
[ERROR][TiApplication( 1721)]   at org.appcelerator.titanium.TiApplication.postAnalyticsEvent(TiApplication.java:664)
[ERROR][TiApplication( 1721)]   at org.appcelerator.titanium.TiLaunchActivity.onDestroy(TiLaunchActivity.java:433)
[ERROR][TiApplication( 1721)]   at org.appcelerator.titanium.TiRootActivity.onDestroy(TiRootActivity.java:145)
[ERROR][TiApplication( 1721)]   at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3642)
[ERROR][TiApplication( 1721)]   ... 11 more
[INFO][ActivityManager(   60)] Displayed activity com.my.project/.MyProjectActivity: 47485 ms (total 2501 ms)
[WARN][NotificationService(   60)] Object died trying to hide notification android.app.ITransientNotification$Stub$Proxy@44f841a0 in package com.my.project
[WARN][ActivityManager(   60)] setProcessForeground called on unknown pid: 1693
[ERROR][TiApplication( 1721)] (KrollRuntimeThread) [208,3252] APP PROXY: ti.modules.titanium.app.AppModule@44f18520
[WARN][V8Object( 1721)] Runtime disposed, cannot set property 'userAgent'
[WARN][ActivityManager(   60)] Activity destroy timeout for HistoryRecord{45067b70 com.my.project/.MyProjectActivity}
[WARN][ActivityManager(   60)] Launch timeout has expired, giving up wake lock!
[WARN][ActivityManager(   60)] Activity idle timeout for HistoryRecord{450be6d0 com.my.project/.MyProjectActivity}
[WARN][TiFastDev( 1721)] (Thread-12) [1,40498] Killing app from Fastdev server request
[ERROR][TiFastDev( 1721)] (Thread-12) [2,40500] null
[ERROR][TiFastDev( 1721)] java.lang.NullPointerException
[ERROR][TiFastDev( 1721)]   at android.widget.Toast.<init>(Toast.java:89)
[ERROR][TiFastDev( 1721)]   at android.widget.Toast.makeText(Toast.java:231)
[ERROR][TiFastDev( 1721)]   at org.appcelerator.kroll.common.TiFastDev.showToast(TiFastDev.java:158)
[ERROR][TiFastDev( 1721)]   at org.appcelerator.kroll.common.TiFastDev$Session.executeKill(TiFastDev.java:443)
[ERROR][TiFastDev( 1721)]   at org.appcelerator.kroll.common.TiFastDev$Session.execute(TiFastDev.java:429)
[ERROR][TiFastDev( 1721)]   at org.appcelerator.kroll.common.TiFastDev$Session.run(TiFastDev.java:360)
[INFO][ActivityManager(   60)] Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.my.project/.MyProjectActivity }
[INFO][AndroidRuntime( 1746)] NOTE: attach of thread 'Binder Thread #3' failed
Thanks in advance for any advice regarding this!

— asked 10 months ago by Dino Trnka
0 Comments

2 Answers

Basically, Android emulator is piece of crap and a lot of issue it has don't exist on device. I don't use it at all, I develop on Android device. If you don't have device, you can try with x86 Android emulator, it's a lot faster (sometime Android emulator has issues just because it's slow).

I solved it. Apparently it only happens if I run the application without killing the previous instance in the emulator. So the solution is to exit the application before opening a new one.

Your Answer

Think you can help? Login to answer this question!