Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28315] Android: App with tableview crashes on back button press to close the app

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionUnresolved
Affected Version/sRelease 9.3.0, Release 9.3.1, Release 10.0.0
Fix Version/sRelease 9.3.1
ComponentsAndroid
Labelsregression
ReporterLokesh Choudhary
AssigneeGary Mathews
Created2021-01-15T19:42:17.000+0000
Updated2021-02-17T03:50:01.000+0000

Description

This is a regression from 9.3.0.GA onwards. Not seen with SDK 9.2.2.GA

Steps to reproduce:

1. Use the code below in your app.js:
const win = Ti.UI.createWindow({ backgroundColor: 'gray' });

const rows = [];
for (let i = 0; i < 100; i++) {
  rows.push({ title: Row #${i} });
}

const tableView = Ti.UI.createTableView({ data: rows });

win.add(tableView);
win.open();
2. Build for android device & let the app launch. 3. Press back button to close the app.

Actual results:

1. We see ACA crash logs showing a crash. No error is seen in the console:
[DEBUG] :  TiBaseActivity: (main) [25579,25948] onBackPressed: exit
[DEBUG] :  AndroidRuntime: Shutting down VM
[DEBUG] :  ACA: (main) [757,26705] ACA crash.report: {
[DEBUG] :  ACA:  "meta": {
[DEBUG] :  ACA:   "handled": false
[DEBUG] :  ACA:  },
[DEBUG] :  ACA:  "message": "Unable to destroy activity {com.app.timob28290\/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference",
[DEBUG] :  ACA:  "stack": [
[DEBUG] :  ACA:   "Unable to destroy activity {com.app.timob28290\/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference\nUnable to destroy activity {com.app.timob28290\/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference",
[DEBUG] :  ACA:   "\n    android.view.ViewConfiguration.get(ViewConfiguration.java:481)\n    android.view.View.<init>(View.java:5059)\n    android.view.View.<init>(View.java:5201)\n    android.view.ViewGroup.<init>(ViewGroup.java:675)\n    android.view.ViewGroup.<init>(ViewGroup.java:671)\n    android.view.ViewGroup.<init>(ViewGroup.java:667)\n    org.appcelerator.titanium.view.TiCompositeLayout.<init>(TiCompositeLayout.java:170)\n    org.appcelerator.titanium.view.TiCompositeLayout.<init>(TiCompositeLayout.java:157)\n    ti.modules.titanium.ui.widget.TiView.<init>(TiView.java:32)\n    ti.modules.titanium.ui.TableViewRowProxy$RowView.<init>(TableViewRowProxy.java:453)\n    ti.modules.titanium.ui.TableViewRowProxy.createView(TableViewRowProxy.java:110)\n    org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:474)\n    ti.modules.titanium.ui.TableViewRowProxy.releaseViews(TableViewRowProxy.java:419)\n    ti.modules.titanium.ui.widget.tableview.TiTableView.release(TiTableView.java:257)\n    ti.modules.titanium.ui.widget.TiUITableView.release(TiUITableView.java:248)\n    org.appcelerator.titanium.proxy.TiViewProxy.releaseViews(TiViewProxy.java:521)\n    ti.modules.titanium.ui.TableViewProxy.releaseViews(TableViewProxy.java:566)\n    org.appcelerator.titanium.proxy.TiViewProxy.releaseViews(TiViewProxy.java:517)\n    org.appcelerator.titanium.TiBaseActivity.onDestroy(TiBaseActivity.java:1530)\n    org.appcelerator.titanium.TiActivity.onDestroy(TiActivity.java:91)\n    android.app.Activity.performDestroy(Activity.java:8048)\n    android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1341)\n    android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4926)\n    android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4970)\n    android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)\n    android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)\n    android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)\n    android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)\n    android.os.Handler.dispatchMessage(Handler.java:107)\n    android.os.Looper.loop(Looper.java:214)\n    android.app.ActivityThread.main(ActivityThread.java:7356)\n    java.lang.reflect.Method.invoke(Native Method)\n    com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)\n    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)"
[DEBUG] :  ACA:  ],
[DEBUG] :  ACA:  "aca_version": "3.0.0"
[DEBUG] :  ACA: }
[INFO] :   APSAnalyticsStore: crash.report
2. Now from the app tray try to launch the app again. 3. The app will launch & will be stuck on the splash screen.

Expected results:

1. No crash happens when app is closed via the back button & launching the app again via app tray launches the app fine.

Comments

  1. Gary Mathews 2021-01-15

    master: https://github.com/appcelerator/titanium_mobile/pull/12386
  2. Joe Falcone 2021-02-17

    We're experiencing many different problems with the new TableView on Android - so many that we're going back to 9.2.2. Wish we had time to document them all but you've got a 5-alarm fire on TableView & ListView.

JSON Source