Android Studio 2.0+ crashes on OS X
Asked Answered
J

1

8

i haven't been able to run any version of Android Studio 2.x. it crashes seemingly randomly with this same exception after < 1min of simply navigating through files in a project:

Exception Name: JavaNativeException
Description: java.lang.NullPointerException
    at sun.lwawt.macosx.CAccessibility.getAccessibleIndexInParent(CAccessibility.java:287)

User Info: (null)

0   CoreFoundation                      0x00007fff94a9e4f2 __exceptionPreprocess + 178
1   libobjc.A.dylib                     0x00007fff88d51f7e objc_exception_throw + 48
2   CoreFoundation                      0x00007fff94a9e439 -[NSException raise] + 9
3   JavaNativeFoundation                0x000000011be9251f JNFCallStaticIntMethod + 236
4   libawt_lwawt.dylib                  0x000000011d7c8deb +[JavaComponentAccessibility createWithAccessible:withEnv:withView:] + 76
5   libawt_lwawt.dylib                  0x000000011d7c930b -[JavaComponentAccessibility accessibilityFocusedUIElement] + 194
6   libawt_lwawt.dylib                  0x000000011d79e4f6 -[AWTView accessibilityFocusedUIElement] + 156
7   AppKit                              0x00007fff98c44d37 -[NSWindow(NSWindowAccessibility) accessibilityFocusedUIElement] + 118
8   libawt_lwawt.dylib                  0x000000011d7c9069 +[JavaComponentAccessibility postFocusChanged:] + 96
9   Foundation                          0x00007fff9427af5e __NSThreadPerformPerform + 279
10  CoreFoundation                      0x00007fff94a33881 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
11  CoreFoundation                      0x00007fff94a12fbc __CFRunLoopDoSources0 + 556
12  CoreFoundation                      0x00007fff94a124df __CFRunLoopRun + 927
13  CoreFoundation                      0x00007fff94a11ed8 CFRunLoopRunSpecific + 296
14  HIToolbox                           0x00007fff963fe935 RunCurrentEventLoopInMode + 235
15  HIToolbox                           0x00007fff963fe76f ReceiveNextEventCommon + 432
16  HIToolbox                           0x00007fff963fe5af _BlockUntilNextEventMatchingListInModeWithFilter + 71
17  AppKit                              0x00007fff98463efa _DPSNextEvent + 1067
18  AppKit                              0x00007fff9846332a -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
19  libosxapp.dylib                     0x000000011d8503aa -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 124
20  AppKit                              0x00007fff98457e84 -[NSApplication run] + 682
21  libosxapp.dylib                     0x000000011d85014d +[NSApplicationAWT runAWTLoopWithApp:] + 156
22  libawt_lwawt.dylib                  0x000000011d7dd4b3 -[AWTStarter starter:] + 905
23  Foundation                          0x00007fff9427af5e __NSThreadPerformPerform + 279
24  CoreFoundation                      0x00007fff94a33881 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
25  CoreFoundation                      0x00007fff94a12fbc __CFRunLoopDoSources0 + 556
26  CoreFoundation                      0x00007fff94a124df __CFRunLoopRun + 927
27  CoreFoundation                      0x00007fff94a11ed8 CFRunLoopRunSpecific + 296
28  studio                              0x00000001000012f3 main + 357
29  studio                              0x000000010000116c start + 52
30  ???                                 0x0000000000000001 0x0 + 1

i'm running OS X 10.11.4 with Java version 1.8.0_92.

i'd seen some other references to this problem in the context of doing drag & drop operations, but the accepted solution of upgrading the JDK version doesn't seem to have resolved my issue.

FWIW i'm able to run Studio 1.5 without encountering this issue.

Jacquelyn answered 4/5, 2016 at 23:24 Comment(5)
sounds like you need to file a bug report.Lister
Same here. I got this since updating to the public beta of MacOS Sierra.Corena
UPDATE - i haven't had a crash reoccurrence since updating to Java 1.8.0_101. previously it would crash within a few minutes of casual usage (opening/closing files, navigating folders). been running for about 30min now without incident.Jacquelyn
Android Studio 2.2 Preview 6 seems to fix this problem too -> sites.google.com/a/android.com/tools/download/studio/canary/…Caresse
Yep, Android 2.2 Beta versions don't have this problem anymoreNowlin
B
0

Answering a question of why it actually happens, but the source has this:

    public static int getAccessibleIndexInParent(final Accessible a, final Component c) {
        if (a == null) return 0;

        return invokeAndWait(new Callable<Integer>() {
            public Integer call() throws Exception {
                final AccessibleContext ac = a.getAccessibleContext();
                if (ac == null) return null;
                return ac.getAccessibleIndexInParent();
            }
        }, c);
    }

As you can see, the Callable returns null in some situations, which is fine for an Integer, but you get a NPE as soon as it unboxes that to return int. They probably should be checking for null and returning 0.

Basrelief answered 14/6, 2016 at 4:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.