android-studio-2.0 - Android Studio 2.0+ 在 OS X 上崩溃

标签 android-studio-2.0 android-studio-2.1

我一直无法运行任何版本的 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

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

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

FWIW 我可以运行 Studio 1.5 而不会遇到这个问题。

最佳答案

回答为什么会发生的问题,但 source有这个:

    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,这对于 Integer 来说很好,但是一旦它拆箱返回 int,你就会得到一个 NPE .他们可能应该检查 null 并返回 0。

关于android-studio-2.0 - Android Studio 2.0+ 在 OS X 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37039760/

相关文章:

Android Studio 2.0 即时运行不起作用但出现此提示?

Android Studio2.1 preview 5 on ubuntu 打不开项目

android-studio-2.0 - Android Studio : Extension Methods are not supported at this language level

android - Android Studio 编辑器中的 SVG 文件警告消息

android - 渲染问题 渲染过程中引发异常 : com/android/util/PropertiesMap

Android Studio 调试器应用程序崩溃并出现 InterruptedException

java - 每次我打开商店 Activity 都会崩溃

android-studio-2.2 - Aldebaran's Pepper sdk for android/Robot sdk 0.9 "Robot SDK' 0. 9' is not complete. Please download it again or re-create the robot application."

Android Studio 2.1.2 和 Android 6 : Error while installing restart patches

java - 在 WebView 中为我的 Android 应用程序使用自定义 (unicode) 字体