Open arifje opened 9 years ago
After some testing I think I found the cause. It's caused by the orientationModes parameter.
My code for initialising the drawer window:
var orientations = [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT];
// alloy landscape for tablets
if(Alloy.Globals.isTablet || Alloy.Globals.isPhablet) {
orientations = [
Ti.UI.PORTRAIT,
Ti.UI.UPSIDE_PORTRAIT,
Ti.UI.LANDSCAPE_LEFT,
Ti.UI.LANDSCAPE_RIGHT
];
}
var mainAppWindow = NappDrawerModule.createDrawer({
opacity: 1,
fullscreen:false,
leftWindow: tmpLeft,
exitOnClose: true,
centerWindow: tmpCenter,
rightWindow: rightWindow,
fading: 0.2, // 0-1
parallaxAmount: 0.2, //0-1
shadowWidth:"5dp",
leftDrawerWidth: drawerWidth,
rightDrawerWidth: drawerWidth,
animationMode: NappDrawerModule.ANIMATION_NONE,
closeDrawerGestureMode: NappDrawerModule.CLOSE_MODE_MARGIN,
openDrawerGestureMode: NappDrawerModule.OPEN_MODE_ALL,
orientationModes: orientations
});
This causes the app to crash randomly. If it not happens the first time the app starts, it happens after restarting the app a few times. When I remove the parameter the drawer works perfectly.
Logcat output:
I/ActivityManager( 548): START u0 {cmp=test.project.com/org.appcelerator.titanium.TiActivity (has extras)} from pid 1852
W/InputMethodManagerService( 548): Focus gain on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@52a04014 (uid=10059 pid=1852)
D/dalvikvm( 1852): GC_FOR_ALLOC freed 774K, 6% free 15164K/16080K, paused 3ms, total 3ms
D/TiAPI ( 1852): windowDidClose main app window!
I/TiAPI ( 1852): [appwindow.js] main drawer window has opened
I/dalvikvm( 1852): Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
W/dalvikvm( 1852): VFY: unable to resolve virtual method 11985: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
D/dalvikvm( 1852): VFY: replacing opcode 0x6f at 0x0000
I/dalvikvm( 1852): Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
W/dalvikvm( 1852): VFY: unable to resolve virtual method 11991: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
D/dalvikvm( 1852): VFY: replacing opcode 0x6f at 0x0000
I/dalvikvm( 1852): Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLa
yout.setHideOnContentScrollEnabled
W/dalvikvm( 1852): VFY: unable to resolve virtual method 9550: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
D/dalvikvm( 1852): VFY: replacing opcode 0x6e at 0x000e
I/dalvikvm( 1852): Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurat
ions
W/dalvikvm( 1852): VFY: unable to resolve virtual method 542: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
D/dalvikvm( 1852): VFY: replacing opcode 0x6e at 0x0002
I/dalvikvm( 1852): Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
W/dalvikvm( 1852): VFY: unable to resolve virtual method 564: Landroid/content/res/TypedArray;.getType (I)I
D/dalvikvm( 1852): VFY: replacing opcode 0x6e at 0x0002
D/AndroidRuntime( 1852): Shutting down VM
W/dalvikvm( 1852): threadid=1: thread exiting with uncaught exception (group=0xa4c8db20)
E/TiApplication( 1852): (main) [296,296] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{test.project.com/org.appcelerator.titani
um.TiActivity}: java.lang.NullPointerException; Titanium 4.1.0,2015/05/27 22:13,17dc875
E/TiApplication( 1852): java.lang.RuntimeException: Unable to start activity ComponentInfo{test.project.com/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException
E/TiApplication( 1852): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
E/TiApplication( 1852): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
E/TiApplication( 1852): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/TiApplication( 1852): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/TiApplication( 1852): at android.os.Handler.dispatchMessage(Handler.java:102)
E/TiApplication( 1852): at android.os.Looper.loop(Looper.java:136)
E/TiApplication( 1852): at android.app.ActivityThread.main(ActivityThread.java:5001)
E/TiApplication( 1852): at java.lang.reflect.Method.invokeNative(Native Method)
E/TiApplication( 1852): at java.lang.reflect.Method.invoke(Method.java:515)
E/TiApplication( 1852): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/TiApplication( 1852): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/TiApplication( 1852): at dalvik.system.NativeStart.main(Native Method)
E/TiApplication( 1852): Caused by: java.lang.NullPointerException
E/TiApplication( 1852): at android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor(ActionBarActivityDelegateBase.java:344)
E/TiApplication( 1852): at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:216)
E/TiApplication( 1852): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:107)
E/TiApplication( 1852): at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:555)
E/TiApplication( 1852): at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
E/TiApplication( 1852): at android.app.Activity.performCreate(Activity.java:5231)
E/TiApplication( 1852): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/TiApplication( 1852): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
E/TiApplication( 1852): ... 11 more
E/AndroidRuntime( 1852): FATAL EXCEPTION: main
E/AndroidRuntime( 1852): Process: test.project.com, PID: 1852
E/AndroidRuntime( 1852): java.lang.RuntimeException: Unable to start activity ComponentInfo{test.project.com/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException
E/AndroidRuntime( 1852): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
E/AndroidRuntime( 1852): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
E/AndroidRuntime( 1852): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 1852): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 1852): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 1852): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 1852): at android.app.ActivityThread.main(ActivityThread.java:5001)
E/AndroidRuntime( 1852): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1852): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 1852): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/AndroidRuntime( 1852): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/AndroidRuntime( 1852): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1852): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 1852): at android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor(ActionBarActivityDelegateBase.java:344)
E/AndroidRuntime( 1852): at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:216)
E/AndroidRuntime( 1852): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:107)
E/AndroidRuntime( 1852): at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:555)
E/AndroidRuntime( 1852): at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
E/AndroidRuntime( 1852): at android.app.Activity.performCreate(Activity.java:5231)
E/AndroidRuntime( 1852): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 1852): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
E/AndroidRuntime( 1852): ... 11 more
W/ActivityManager( 548): Force finishing activity test.project.com/org.appcelerator.titanium.TiActivity
W/ActivityManager( 548): Force finishing activity test.project.com/.TestProjectActivity
W/ActivityManager( 548): Activity pause timeout for ActivityRecord{52a1e314 u0 test.project.com/org.appcelerator.titanium.TiActivity t24 f}
A fix would be great, can't release my app at the moment :-(
I created a clean testproject which can be downloaded here: http://a.pomf.se/hnggbq.zip
I ran into the same problem and found a different way to hide the actionBar due XML. To do this create a folder called 'values' in 'platform/android/res'. Next, create a new file in the values map and name it 'no-actionbar.xml' upon creation paste the following code into that file:
`<?xml version="1.0" encoding="UTF-8"?>
I am hiding the actionBar after the nappdrawer window has opened, but with SDK 4.X.X (tried 4.0.0.GA and 4.0.1, 4.1.0) it crashes randomly.
Hiding the actionbar (works on 3.5.1.GA)
Now, with the latest 4.X SDK, it crashes randomly, and generating the following error:
When I don't hide the actionbar it doesn't crash.