NOTE: This is an intermittent issue. I could reproduce it 4-5 times with sdk 3.2.3.v20140422101718 & once with sdk 3.2.2.GA. So I guess this is not regression.
Description:
1. Create an app alloy or classic.
2. Set a breakpoint in the app for debug.
3. Debug it on device.
Actual Result:
1. The app crashes and we get "the app has stopped working" message.
2. Alan saw some timing issue while opening the window:
@Override
protected void handleOpen(KrollDict options)
{
Activity topActivity = TiApplication.getAppCurrentActivity();
Intent intent = new Intent(topActivity, TiActivity.class); //It's is crashing on this line (198) where topActivity is null
fillIntent(topActivity, intent);
3. My console logs:
E/TiApplication( 9518): java.lang.RuntimeException: Unable to pause activity {com.app.xalloy/com.app.xalloy.XalloyActivity}: java.lang.NullPointerException
E/TiApplication( 9518): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3016)
E/TiApplication( 9518): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2971)
E/TiApplication( 9518): at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2949)
E/TiApplication( 9518): at android.app.ActivityThread.access$800(ActivityThread.java:141)
E/TiApplication( 9518): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1251)
E/TiApplication( 9518): at android.os.Handler.dispatchMessage(Handler.java:99)
E/TiApplication( 9518): at android.os.Looper.loop(Looper.java:137)
E/TiApplication( 9518): at android.app.ActivityThread.main(ActivityThread.java:5039)
E/TiApplication( 9518): at java.lang.reflect.Method.invokeNative(Native Method)
E/TiApplication( 9518): at java.lang.reflect.Method.invoke(Method.java:511)
E/TiApplication( 9518): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/TiApplication( 9518): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/TiApplication( 9518): at dalvik.system.NativeStart.main(Native Method)
E/TiApplication( 9518): Caused by: java.lang.NullPointerException
E/TiApplication( 9518): at android.content.ComponentName.<init>(ComponentName.java:75)
E/TiApplication( 9518): at android.content.Intent.<init>(Intent.java:3491)
E/TiApplication( 9518): at ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:198)
E/TiApplication( 9518): at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:89)
E/TiApplication( 9518): at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:443)
E/TiApplication( 9518): at android.os.Handler.dispatchMessage(Handler.java:95)
E/TiApplication( 9518): at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:389)
E/TiApplication( 9518): at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:374)
E/TiApplication( 9518): at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:252)
E/TiApplication( 9518): at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:286)
E/TiApplication( 9518): at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:186)
E/TiApplication( 9518): at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:763)
E/TiApplication( 9518): at org.appcelerator.titanium.TiBaseActivity.onPause(TiBaseActivity.java:975)
E/TiApplication( 9518): at org.appcelerator.titanium.TiLaunchActivity.onPause(TiLaunchActivity.java:338)
E/TiApplication( 9518): at android.app.Activity.performPause(Activity.java:5206)
E/TiApplication( 9518): at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1226)
E/TiApplication( 9518): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3002)
E/TiApplication( 9518): ... 12 more
E/AndroidRuntime( 9518): FATAL EXCEPTION: main
E/AndroidRuntime( 9518): java.lang.RuntimeException: Unable to pause activity {com.app.xalloy/com.app.xalloy.XalloyActivity}: java.lang.NullPointerException
E/AndroidRuntime( 9518): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3016)
E/AndroidRuntime( 9518): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2971)
E/AndroidRuntime( 9518): at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2949)
E/AndroidRuntime( 9518): at android.app.ActivityThread.access$800(ActivityThread.java:141)
E/AndroidRuntime( 9518): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1251)
E/AndroidRuntime( 9518): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 9518): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 9518): at android.app.ActivityThread.main(ActivityThread.java:5039)
E/AndroidRuntime( 9518): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 9518): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 9518): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 9518): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 9518): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 9518): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 9518): at android.content.ComponentName.<init>(ComponentName.java:75)
E/AndroidRuntime( 9518): at android.content.Intent.<init>(Intent.java:3491)
E/AndroidRuntime( 9518): at ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:198)
E/AndroidRuntime( 9518): at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:89)
E/AndroidRuntime( 9518): at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:443)
E/AndroidRuntime( 9518): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 9518): at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:389)
E/AndroidRuntime( 9518): at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:374)
E/AndroidRuntime( 9518): at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:252)
E/AndroidRuntime( 9518): at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:286)
E/AndroidRuntime( 9518): at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:186)
E/AndroidRuntime( 9518): at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:763)
E/AndroidRuntime( 9518): at org.appcelerator.titanium.TiBaseActivity.onPause(TiBaseActivity.java:975)
E/AndroidRuntime( 9518): at org.appcelerator.titanium.TiLaunchActivity.onPause(TiLaunchActivity.java:338)
E/AndroidRuntime( 9518): at android.app.Activity.performPause(Activity.java:5206)
E/AndroidRuntime( 9518): at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1226)
E/AndroidRuntime( 9518): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3002)
E/AndroidRuntime( 9518): ... 12 more
D/overlay ( 161): FROM_STATE = OV_BYPASS_3_LAYER TO_STATE = OV_CLOSED
I/v8 ( 9752): Failed to open socket on port 2525, waiting 1000 ms before retrying
Expected Result:
1. The app should not crash & successfully launch.
*Cannot* reproduce issue on: Appcelerator Studio, build: 4.4.0.201511241829 Appc CLI NPM: 4.2.2 Appc CLI Core: 5.1.0 Arrow: 1.3.22 SDK: 5.1.1.GA Node: v4.2.2 OS: El Capitan (10.11.1) Devices: Samsung Galaxy S5 (4.4.2)
We have an application in Android Store and very recently we have been receiving application crash at handleOpen caused by java.lang.NullPointerException. The issue also happens in Galaxy S5 too as reported. The application had been built using 3.5.0.GA. In WindowProxy.java, we see that a null check has been added from 4.x SDK.
This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.