Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15971] Android: App Resume Crash with the Urban Airship Module

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-07-16T18:34:06.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, module, urbanairship
ReporterArnaud Besnier
AssigneeHieu Pham
Created2013-11-21T11:39:21.000+0000
Updated2017-03-22T22:37:48.000+0000

Description

If you add the UrbanAirship module for Android to the Kitchen Sink app, the app opens on a blank/black window after being backgrounded (and the app memory has been released). Without this module, Kitchen Sink works properly. Set up Kitchen Sink for the issue 1. Download the Kitchen Sink source code 2. Include the latest Urban Airship module (https://github.com/appcelerator/titanium_modules/tree/master/urbanairship/mobile/android) to Kitchen Sink. - Add the module in the source code. - Add the module just below the other modules in the tiapp.xml: ti.urbanairship Steps to reproduce the bug: 1. Open Kitchen Sink 2. Click on the home button, to let the app live in background 3. Open at least 15 other apps, and let the live by clicking on the home button. (The aim, here, is to destroy the Kitchen Sink alive activities in order to force the app to "restart"). Actually you have to open apps until the Kitchen Sink activities desappear when you launch the command: adb shell dumpsys activity 4. Resume the Kitchen Sink app Observed behavior: app freeze on a black screen Expected behavior: "clean" restart

Attachments

FileDateSize
tiapp.xml2013-11-21T11:39:21.000+00002835

Comments

  1. Ivan Skugor 2013-12-17

    Noticed this issue also, it happens when app is put in the background for some time. Black screen can be seen and after back button is pressed to close that black screen, splash screen is shown and app is restarted.
  2. Alex Bernier 2014-01-19

    I'm seeing this on 3.2 SDK without the Urban Airship module, when installed from Studio (not seeing when installed from TestFlight). Here are the modules I'm using, though my list hasn't changed from 3.1.3.GA to 3.2.GA, so it seems 3.2.GA SDK is the cause, not a specific module: ti.cloud ti.cloudpush analytics.google ti.imagefactory facebook Only seeing this in dev, though, so we're not production impacted.
  3. Adam Magana 2014-02-07

    I can confirm that my company is having the same issue with our Android app. We are also using the Urban Airship module so I cannot confirm whether or not Alejandro's issue is something else entirely. Currently this bug is occurring in our production release of our app so this is extremely high priority for us. We will be rolling back our Titanium version until a fix can be made.
  4. Ingo Muschenetz 2014-02-07

    [~adammagana] A few questions:

    What version of SDK are you using that works?

    Which version fails?

    What are the modules you are using in your project?

    Can you please file the crash log?

  5. Adam Magana 2014-02-07

    Since I left the first comment we've had a development. We reverted our Titanium SDK version to 3.1.3.GA and our CLI version to 3.1.2 but we are still having crashes. We have tried deploying using deploy type test and deploy type production. The only module we are using is the Urban Airship (https://github.com/appcelerator/titanium_modules/blob/master/urbanairship/mobile/android/documentation/index.md) module. Here is our crash log:
       02-07 14:32:23.498: E/TiApplication(32117): (main) [1141,1459] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to resume activity {com.drund.mobile/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException; Titanium 3.1.3,2013/09/18 12:01,222f4d1
       02-07 14:32:23.498: E/TiApplication(32117): java.lang.RuntimeException: Unable to resume activity {com.drund.mobile/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException
       02-07 14:32:23.498: E/TiApplication(32117): 	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3228)
       02-07 14:32:23.498: E/TiApplication(32117): 	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3266)
       02-07 14:32:23.498: E/TiApplication(32117): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2579)
       02-07 14:32:23.498: E/TiApplication(32117): 	at android.app.ActivityThread.access$600(ActivityThread.java:162)
       02-07 14:32:23.498: E/TiApplication(32117): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1413)
       02-07 14:32:23.498: E/TiApplication(32117): 	at android.os.Handler.dispatchMessage(Handler.java:99)
       02-07 14:32:23.498: E/TiApplication(32117): 	at android.os.Looper.loop(Looper.java:158)
       02-07 14:32:23.498: E/TiApplication(32117): 	at android.app.ActivityThread.main(ActivityThread.java:5789)
       02-07 14:32:23.498: E/TiApplication(32117): 	at java.lang.reflect.Method.invokeNative(Native Method)
       02-07 14:32:23.498: E/TiApplication(32117): 	at java.lang.reflect.Method.invoke(Method.java:525)
       02-07 14:32:23.498: E/TiApplication(32117): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
       02-07 14:32:23.498: E/TiApplication(32117): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:843)
       02-07 14:32:23.498: E/TiApplication(32117): 	at dalvik.system.NativeStart.main(Native Method)
       02-07 14:32:23.498: E/TiApplication(32117): Caused by: java.lang.NullPointerException
       02-07 14:32:23.498: E/TiApplication(32117): 	at org.appcelerator.titanium.TiApplication.postAnalyticsEvent(TiApplication.java:662)
       02-07 14:32:23.498: E/TiApplication(32117): 	at org.appcelerator.titanium.TiBaseActivity.onResume(TiBaseActivity.java:973)
       02-07 14:32:23.498: E/TiApplication(32117): 	at org.appcelerator.titanium.TiActivity.onResume(TiActivity.java:35)
       02-07 14:32:23.498: E/TiApplication(32117): 	at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1282)
       02-07 14:32:23.498: E/TiApplication(32117): 	at android.app.Activity.performResume(Activity.java:5287)
       02-07 14:32:23.498: E/TiApplication(32117): 	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3211)
       02-07 14:32:23.498: E/TiApplication(32117): 	... 12 more
       
  6. Ingo Muschenetz 2014-02-07

    That appears to be caused by this line: https://github.com/appcelerator/titanium_mobile/blob/3_1_X/android/titanium/src/java/org/appcelerator/titanium/TiApplication.java#L662 or this in master: https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/TiApplication.java#L690 It seems that https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/TiApplication.java#L495 (collectAnalytics) appears to have returned false.
  7. Ingo Muschenetz 2014-06-02

    [~hpham] to double-check if still crashing with 3.3.0.
  8. Ingo Muschenetz 2014-06-19

    All, we believe this may have been solved in SDK 3.3.0 (or that the exception above noting the error of org.appcelerator.titanium.TiApplication.postAnalyticsEvent() is a red herring and will now be replaced with the true error). Can you all please try this with SDK 3.3.0 and let us know if the issue is resolved or if you get a different error.
  9. Ingo Muschenetz 2014-06-23

    All, please try build #77 of 3.3.X (from http://builds.appcelerator.com/#3_3_X) to see if this addresses the issue. This includes a fix for thread-safety in analytics.
  10. Arnaud Besnier 2014-07-02

    I tried the 3.3.0.Beta SDK and I am sorry to tell you that the bug still happens.
  11. Ingo Muschenetz 2014-07-06

    [~arnaud] Can you please tell me the exact version you tried? Was it build #77 or later? If you are still getting the crash, what is the crash you are now getting?
  12. Arnaud Besnier 2014-07-07

    I don't know which version it is. I think I downloaded it from this page: https://www.appcelerator.com/blog/2014/06/announcing-the-3-3-0-release-candidate-of-titanium-sdk-and-studio/ The SDK name is 3.3.0.Beta (now the page link enables to download the 3.3.0.RC) but I don't which version. Can you tell me if I can find this info in the SDK package? The bug may not be exactly the same (I tried this new SDK in development environment - vs the issue found in production -) The application opens a "white screen" (empty activity), like it does with old SDKs. And then, the app crashes (I did not experience that with the production app).
  13. Ingo Muschenetz 2014-07-07

    [~arnaud_besnier] What is the crash log?
  14. Arnaud Besnier 2014-07-11

    I tried to reproduce the bug with the latest 3.3.0.RC and also 3.3.0.v20140710142512-osx. The bug is still present. Here is the crash log: 7-11 14:31:40.180: D/TiProperties(6221): (KrollRuntimeThread) [38,2934] setBool called with key:UrbanAirship.showAppOnClick, value:true 07-11 14:31:40.535: I/TiAPI(6221): | 2014-07-11 14:31:40:519 | ===> UrbanAirship Registration 07-11 14:31:41.890: I/Dev 1.0.0 - UALib(6221): Sending Analytics to: https://combine.urbanairship.com/warp9/ 07-11 14:32:20.940: D/dalvikvm(7562): Trying to load lib /data/app-lib/com.shopmium-1/libti.urbanairship.so 0x425b3398 07-11 14:32:20.945: D/dalvikvm(7562): Added shared lib /data/app-lib/com.shopmium-1/libti.urbanairship.so 0x425b3398 07-11 14:32:20.945: D/dalvikvm(7562): No JNI_OnLoad found in /data/app-lib/com.shopmium-1/libti.urbanairship.so 0x425b3398, skipping init 07-11 14:32:49.900: D/KrollV8Runtime(8723): (KrollRuntimeThread) [5,1994] Bootstrapping module: ti.urbanairship 07-11 14:32:49.905: D/dalvikvm(8723): Trying to load lib /data/app-lib/com.shopmium.dev-1/libti.urbanairship.so 0x425b5fd8 07-11 14:32:49.910: D/dalvikvm(8723): Added shared lib /data/app-lib/com.shopmium.dev-1/libti.urbanairship.so 0x425b5fd8 07-11 14:32:49.910: D/dalvikvm(8723): No JNI_OnLoad found in /data/app-lib/com.shopmium.dev-1/libti.urbanairship.so 0x425b5fd8, skipping init 07-11 14:32:52.205: I/Dev 1.0.0 - UALib(8723): Sending Analytics to: https://combine.urbanairship.com/warp9/ 07-11 14:32:53.615: W/ActivityManager(2347): Unable to start service Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.shopmium.dev flg=0x8000014 cmp=com.shopmium.dev/com.urbanairship.push.GCMPushReceiver (has extras) } U=0: not found 07-11 14:32:57.120: D/dalvikvm(9057): Trying to load lib /data/app-lib/com.shopmium-1/libti.urbanairship.so 0x425b0d38 07-11 14:32:57.130: D/dalvikvm(9057): Added shared lib /data/app-lib/com.shopmium-1/libti.urbanairship.so 0x425b0d38 07-11 14:32:57.130: D/dalvikvm(9057): No JNI_OnLoad found in /data/app-lib/com.shopmium-1/libti.urbanairship.so 0x425b0d38, skipping init We tried to update the UrbanAirship module with the latest UrbanAirship library (4.0.2), it does not fix the bug. Are you really sure the SDK can fix something?
  15. Arnaud Besnier 2014-07-15

    With a minimal Titanium app, the bug is present. I tried to create a minimal Android native app with the Urban Airship integration (library version 4.0.2), I did not manage to reproduce the bug. I have no doubts now, that Titanium integration is the origin of the issue. Do you have any inputs? Could we patch the SDK (even a ugly patch) ?
  16. jay splaine 2014-07-15

  17. Arnaud Besnier 2014-07-15

    Ok, I just tried your patch. It works! the app restarts properly. Reading the code, I don't feel like this patch could bring severe regression. Can we be confident with it? What do you think? Thank you for your help
  18. Ping Wang 2014-07-16

    This is a duplicate of TIMOB-16538.
  19. Lee Morris 2017-03-22

    Closing ticket with reference to previous comments.

JSON Source