Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-23938

Android: Titanium crashes if back button is hit soon enough after app launch

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 6.0.0
    • Component/s: Android
    • Environment:

      TI 3.5.0.GA
      Mac Yosemite
      Devices: Samsung Galaxy S5 and Note3 (and others)

    • Story Points:
      5
    • Sprint:
      2015 Sprint 05 SDK, 2016 Sprint 20 SDK

      Description

      Based on http://developer.appcelerator.com/question/180283/always-a-crash-race-condition-with-android-back-button

      Summary - If you press back fast enough during app open Titanium apps will crash. Looks like the android back event that causes the app to tear down can cause the root UI element to be null when adding the first Window of the project to it.

      This happens on device for the bare minimum installs of Titanium project with or without Alloy. Easier to repro on Alloy as it takes a bit longer for the app to launch.

      TI 3.5.0.GA
      Mac Yosemite
      Samsung Galaxy S5 and Note3 (and others)

      1. ti create a new android project
      2. cd into root of project
      3. alloy create
      4. ti build -p android -T device --device-id <device>
      5. Important step: On the device (not simulator), launch app AND IMMEDIATELY start pressing back button.

        • Keep closing and reopening app as fast as you can if you don't see it repro the first time in step 5
            • This happens when a Window is the default/first item created in the Activity as well

      Expected -
      App closes

      Actual -
      App crashes and closes

      Stack -
      01-27 13:32:08.269: E/AndroidRuntime(20104): FATAL EXCEPTION: main
      01-27 13:32:08.269: E/AndroidRuntime(20104): Process: com.test, PID: 20104
      01-27 13:32:08.269: E/AndroidRuntime(20104): java.lang.NullPointerException
      01-27 13:32:08.269: E/AndroidRuntime(20104): at android.content.ComponentName.<init>(ComponentName.java:77)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at android.content.Intent.<init>(Intent.java:4445)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:127)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:88)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:415)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at android.os.Handler.dispatchMessage(Handler.java:98)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at android.os.Looper.loop(Looper.java:146)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at android.app.ActivityThread.main(ActivityThread.java:5678)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at java.lang.reflect.Method.invokeNative(Native Method)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at java.lang.reflect.Method.invoke(Method.java:515)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
      01-27 13:32:08.269: E/AndroidRuntime(20104): at dalvik.system.NativeStart.main(Native Method)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gmathews Gary Mathews
                Reporter:
                ygbr Ygor Lemos
                Reviewer:
                Ashraf Abu (Inactive)
                Tester:
                Josh Longton
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-10128
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code