Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2876] Android: TiPlatformHelper NPE on Galaxy Tab

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T02:00:19.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M06
ComponentsAndroid
Labelsandroid, defect, platform, release-1.6.0, reported-1.6.0
ReporterMarshall Culpepper
AssigneeMarshall Culpepper
Created2011-04-15T03:31:47.000+0000
Updated2011-04-17T02:00:19.000+0000

Description

Looks like we rely on the internal "tiApp" to be set from initialize(), but we can just use the instance from TiApplication.getInstance() to avoid the NPE. Here's the trace:


E/TiUncaughtHandler(31008): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.appcelerator.kitchensink/org.appcelerator.kitchensink.KitchensinkActivity}: java.lang.NullPointerException
E/TiUncaughtHandler(31008):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
E/TiUncaughtHandler(31008):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/TiUncaughtHandler(31008):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/TiUncaughtHandler(31008):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/TiUncaughtHandler(31008):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/TiUncaughtHandler(31008):     at android.os.Looper.loop(Looper.java:123)
E/TiUncaughtHandler(31008):     at android.app.ActivityThread.main(ActivityThread.java:4627)
E/TiUncaughtHandler(31008):     at java.lang.reflect.Method.invokeNative(Native Method)
E/TiUncaughtHandler(31008):     at java.lang.reflect.Method.invoke(Method.java:521)
E/TiUncaughtHandler(31008):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
E/TiUncaughtHandler(31008):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
E/TiUncaughtHandler(31008):     at dalvik.system.NativeStart.main(Native Method)
E/TiUncaughtHandler(31008): Caused by: java.lang.NullPointerException
E/TiUncaughtHandler(31008):     at org.appcelerator.titanium.util.TiPlatformHelper.getMacaddress(TiPlatformHelper.java:306)
E/TiUncaughtHandler(31008):     at org.appcelerator.titanium.analytics.TiAnalyticsEventFactory.createAppEnrollEvent(TiAnalyticsEventFactory.java:66)
E/TiUncaughtHandler(31008):     at org.appcelerator.titanium.TiApplication.setRootActivity(TiApplication.java:263)
E/TiUncaughtHandler(31008):     at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:118)
E/TiUncaughtHandler(31008):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/TiUncaughtHandler(31008):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/TiUncaughtHandler(31008):     ... 11 more

Comments

  1. Marshall Culpepper 2011-04-15

    (from [0b7f8b674cc29ae73424f2c5de1375449388ef38]) use the static instance of TiApplication that already lives in getInstance(), this removes a dependency on initialize from
    TiPlatformHelper that's needed from Analytics [#2876 state:fixed-in-qa]
    https://github.com/appcelerator/titanium_mobile/commit/0b7f8b674cc29ae73424f2c5de1375449388ef38"> https://github.com/appcelerator/titanium_mobile/commit/0b7f8b674cc2...

  2. Marshall Culpepper 2011-04-15

    (from [aa8c4515822484c9913232ca92b551ae3920ef76]) forgot to add TiApplication to last commit [#2876] https://github.com/appcelerator/titanium_mobile/commit/aa8c4515822484c9913232ca92b551ae3920ef76"> https://github.com/appcelerator/titanium_mobile/commit/aa8c45158224...

  3. Thomas Huelbert 2011-04-15

    as per Mr Culpepper: "the crash in this test was happening on initial launch / fresh install of KitchenSink on the Galaxy Tab. make sure you have KS uninstalled on the tab, then install it and run it from Developer.. if no crashes your golden"

    fresh install of KS on galaxy tab (2.2.2) using [INFO] Titanium SDK version: 1.6.0 (02/03/11 09:22 a02f7db)

JSON Source