[TIMOB-19613] Android: Crash when opening Window themed with ActionBar if app is themed without
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Fokke Zandbergen |
Assignee | Unknown |
Created | 2015-09-29T09:57:38.000+0000 |
Updated | 2018-02-28T19:54:58.000+0000 |
Description
If you use a built-in or custom theme that has no action (title) bar or trigger a built-in theme without action bar with
<navbar-hidden>true</navbar-hidden>
the app will log errors and finally crash if you open a window and use the theme
property to select a built-in or custom theme *with* action bar.
*Steps*
1. Create a new app
2. Use the code below as app.js
3. Build to device and confirm it works and shows ActionBar on both screens
4. Change the application theme to one without ActionBar either by setting <navbar-hidden>true</navbar-hidden>
or:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<application android:theme="@style/Theme.AppCompat.NoTitleBar" />
</manifest>
</android>
5. Build to device and confirm the app logs errors and finally crashes after tapping the red window.
var redWin = Ti.UI.createWindow({
backgroundColor: 'red'
});
var blueWin = Ti.UI.createWindow({
backgroundColor: 'blue',
theme: 'Theme.AppCompat'
});
redWin.addEventListener('click', function() {
blueWin.open();
});
redWin.open();
*Logs*
-- Start application log -----------------------------------------------------
[INFO] TiApplication: (main) [1,1] checkpoint, app created.
[INFO] TiApplication: (main) [74,75] Titanium 5.0.1 (2015/09/24 10:39 9640236)
[INFO] TiApplication: (main) [24,99] Titanium Javascript runtime: v8
[INFO] TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[WARN] V8Object: (KrollRuntimeThread) [88,88] Runtime disposed, cannot set property 'userAgent'
[INFO] TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = test.theme.ThemeActivity@2526cdf2
[DEBUG] OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
[DEBUG] Atlas: Validating map...
[INFO] I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 01/14/15, ab0075f, Id3510ff6dc
[INFO] OpenGLRenderer: Initialized EGL, version 1.4
[DEBUG] OpenGLRenderer: Enabling debug mode 0
[DEBUG] Window: Checkpoint: postWindowCreated()
[DEBUG] Window: Checkpoint: postWindowCreated()
[INFO] art: Background partial concurrent mark sweep GC freed 8715(249KB) AllocSpace objects, 0(0B) LOS objects, 37% free, 26MB/42MB, paused 5.594ms total 42.961ms
[INFO] art: Background sticky concurrent mark sweep GC freed 53858(911KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 41MB/42MB, paused 17.777ms total 133.105ms
[INFO] art: Background sticky concurrent mark sweep GC freed 1954(33KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 42MB/42MB, paused 18.662ms total 67.852ms
[INFO] art: Background partial concurrent mark sweep GC freed 21882(984KB) AllocSpace objects, 0(0B) LOS objects, 27% free, 41MB/57MB, paused 21.410ms total 115.354ms
[INFO] art: Background sticky concurrent mark sweep GC freed 54514(922KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 56MB/57MB, paused 32.617ms total 192.886ms
[INFO] art: Background partial concurrent mark sweep GC freed 21362(920KB) AllocSpace objects, 0(0B) LOS objects, 22% free, 56MB/72MB, paused 34.540ms total 190.412ms
[INFO] art: Background sticky concurrent mark sweep GC freed 53354(903KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 71MB/72MB, paused 48.132ms total 212.547ms
[INFO] art: Background partial concurrent mark sweep GC freed 23274(954KB) AllocSpace objects, 0(0B) LOS objects, 18% free, 71MB/87MB, paused 48.941ms total 275.349ms
[INFO] art: Background sticky concurrent mark sweep GC freed 54192(917KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 87MB/87MB, paused 68.337ms total 273.918ms
[INFO] art: Background partial concurrent mark sweep GC freed 24296(997KB) AllocSpace objects, 0(0B) LOS objects, 15% free, 87MB/103MB, paused 76.684ms total 382.447ms
[INFO] art: Background sticky concurrent mark sweep GC freed 53924(912KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 102MB/103MB, paused 79.764ms total 331.339ms
[INFO] art: Background partial concurrent mark sweep GC freed 25698(1020KB) AllocSpace objects, 0(0B) LOS objects, 13% free, 103MB/119MB, paused 93.576ms total 490.925ms
[INFO] art: Background sticky concurrent mark sweep GC freed 54516(922KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 118MB/119MB, paused 93.131ms total 368.544ms
[INFO] art: Background partial concurrent mark sweep GC freed 25628(1039KB) AllocSpace objects, 0(0B) LOS objects, 11% free, 119MB/135MB, paused 114.099ms total 552.203ms
[DEBUG] AndroidRuntime: Shutting down VM
[INFO] art: Background sticky concurrent mark sweep GC freed 86484(7MB) AllocSpace objects, 12(5MB) LOS objects, 0% free, 179MB/179MB, paused 1.379ms total 915.809ms
[INFO] art: WaitForGcToComplete blocked for 123.499ms for cause Alloc
[INFO] art: Background partial concurrent mark sweep GC freed 106546(13MB) AllocSpace objects, 3(4MB) LOS objects, 8% free, 170MB/186MB, paused 1.112ms total 387.401ms
[INFO] art: WaitForGcToComplete blocked for 286.582ms for cause Alloc
[INFO] art: Alloc sticky concurrent mark sweep GC freed 45806(5MB) AllocSpace objects, 0(0B) LOS objects, 4% free, 177MB/185MB, paused 1.666ms total 31.411ms
[INFO] art: Background partial concurrent mark sweep GC freed 66289(8MB) AllocSpace objects, 2(11MB) LOS objects, 8% free, 172MB/188MB, paused 1.131ms total 241.444ms
[INFO] art: WaitForGcToComplete blocked for 170.134ms for cause Alloc
[INFO] art: WaitForGcToComplete blocked for 31.288ms for cause Alloc
[INFO] art: Background partial concurrent mark sweep GC freed 221053(28MB) AllocSpace objects, 1(10MB) LOS objects, 9% free, 153MB/169MB, paused 1.009ms total 201.905ms
[INFO] art: WaitForGcToComplete blocked for 160.997ms for cause Alloc
[INFO] art: Background partial concurrent mark sweep GC freed 269280(34MB) AllocSpace objects, 1(15MB) LOS objects, 10% free, 140MB/156MB, paused 961us total 176.978ms
[INFO] art: Background partial concurrent mark sweep GC freed 245049(31MB) AllocSpace objects, 1(23MB) LOS objects, 11% free, 124MB/140MB, paused 876us total 136.280ms
[INFO] art: WaitForGcToComplete blocked for 69.331ms for cause Alloc
[WARN] art: Suspending all threads took: 76.277ms
[INFO] art: Background sticky concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 0% free, 176MB/176MB, paused 78.287ms total 155.378ms
[ERROR] TiApplication: (main) [22061,22061] Sending event: exception on thread: main msg:java.lang.StackOverflowError: stack size 8MB; Titanium 5.0.1,2015/09/24 10:39,9640236
[ERROR] TiApplication: java.lang.StackOverflowError: stack size 8MB
[ERROR] TiApplication: at java.lang.reflect.Constructor.newInstance(Native Method)
[ERROR] TiApplication: at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
[ERROR] TiApplication: at android.view.LayoutInflater.createView(LayoutInflater.java:607)
[ERROR] TiApplication: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
[ERROR] TiApplication: at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
[ERROR] TiApplication: at android.view.LayoutInflater.parseInclude(LayoutInflater.java:890)
[ERROR] TiApplication: at android.view.LayoutInflater.rInflate(LayoutInflater.java:802)
[ERROR] TiApplication: at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
[ERROR] TiApplication: at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
[ERROR] TiApplication: at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:321)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.createSupportActionBar(AppCompatDelegateImplV7.java:171)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(AppCompatDelegateImplBase.java:85)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.onTitleChanged(AppCompatDelegateImplV7.java:494)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:400)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.createSupportActionBar(AppCompatDelegateImplV7.java:171)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(AppCompatDelegateImplBase.java:85)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.onTitleChanged(AppCompatDelegateImplV7.java:494)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:400)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.createSupportActionBar(AppCompatDelegateImplV7.java:171)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(AppCompatDelegateImplBase.java:85)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.onTitleChanged(AppCompatDelegateImplV7.java:494)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:400)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.createSupportActionBar(AppCompatDelegateImplV7.java:171)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(AppCompatDelegateImplBase.java:85)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.onTitleChanged(AppCompatDelegateImplV7.java:494)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:400)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.createSupportActionBar(AppCompatDelegateImplV7.java:171)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(AppCompatDelegateImplBase.java:85)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.onTitleChanged(AppCompatDelegateImplV7.java:494)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:400)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.createSupportActionBar(AppCompatDelegateImplV7.java:171)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplBase.getSupportActio
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.onTitleChanged(AppCompatDelegateImplV7.java:494)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:400)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.createSupportActionBar(AppCompatDelegateImplV7.java:171)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(AppCompatDelegateImplBase.java:85)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.onTitleChanged(AppCompatDelegateImplV7.java:494)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:400)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplV7.createSupportActionBar(AppCompatDelegateImplV7.java:171)
[ERROR] TiApplication: at android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(A
[INFO] art: Background partial concurrent mark sweep GC freed 198746(25MB) AllocSpace objects, 15(91MB) LOS objects, 17% free, 75MB/91MB, paused 1.051ms total 151.005ms
[INFO] art: WaitForGcToComplete blocked for 90.042ms for cause Alloc
[INFO] art: Background partial concurrent mark sweep GC freed 85908(10MB) AllocSpace objects, 3(10MB) LOS objects, 14% free, 96MB/112MB, paused 1.037ms total 104.463ms
[INFO] art: Background partial concurrent mark sweep GC freed 61503(7MB) AllocSpace objects, 4(22MB) LOS objects, 10% free, 131MB/147MB, paused 1.285ms total 116.632ms
[INFO] art: Background partial concurrent mark sweep GC freed 8(480B) AllocSpace objects, 2(4MB) LOS objects, 9% free, 147MB/163MB, paused 1.018ms total 116.157ms
[INFO] art: Background partial concurrent mark sweep GC freed 6(192B) AllocSpace objects, 1(16MB) LOS objects, 9% free, 153MB/169MB, paused 963us total 111.626ms
[INFO] art: WaitForGcToComplete blocked for 70.812ms for cause Alloc
[INFO] art: Background partial concurrent mark sweep GC freed 53858(6MB) AllocSpace objects, 1(23MB) LOS objects, 9% free, 156MB/172MB, paused 1.041ms total 111.655ms
[INFO] art: WaitForGcToComplete blocked for 24.717ms for cause Alloc
[INFO] art: Background partial concurrent mark sweep GC freed 19567(2MB) AllocSpace objects, 11(36MB) LOS objects, 9% free, 150MB/166MB, paused 1.204ms total 141.920ms
[INFO] art: Background partial concurrent mark sweep GC freed 73087(8MB) AllocSpace objects, 2(17MB) LOS objects, 12% free, 112MB/128MB, paused 1.114ms total 103.525ms
[INFO] art: Background partial concurrent mark sweep GC freed 52464(7MB) AllocSpace objects, 1(23MB) LOS objects, 9% free, 156MB/172MB, paused 1.286ms total 113.472ms
[ERROR] JavaBinder: !!! FAILED BINDER TRANSACTION !!!
[INFO] Process: Sending signal. PID: 10402 SIG: 9
Can confirm this bevahiour with 5.0.2.GA. A workaround is to not define a default theme in tiapp.xml but with the 'theme' property for every window. If done so, the root window of the application can have no actionbar (theme: 'Theme.AppCompat.NoTitleBar.Fullscreen') while other windows opened later can (theme: 'Theme.AppCompat')