8

我无法运行任何版本的 Android Studio 2.x。在简单地浏览项目中的文件 < 1 分钟后,它似乎随机崩溃并出现同样的异常:

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

我正在使用 Java 版本 1.8.0_92 运行 OS X 10.11.4。

我在拖放操作的上下文中看到了其他一些关于这个问题的引用,但是升级 JDK 版本的公认解决方案似乎并没有解决我的问题。

FWIW 我能够运行 Studio 1.5 而不会遇到此问题。

4

1 回答 1

0

回答为什么会发生这种情况的问题,但来源有:

    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);
    }

如您所见,Callable在某些情况下返回 null ,这对于 a 来说很好Integer,但是一旦将它拆箱返回,您就会得到一个 NPE int。他们可能应该检查 null 并返回 0。

于 2016-06-14T04:44:32.170 回答