Android Studio 4.2.1 启动时出现 NullPointer 异常

Posted

技术标签:

【中文标题】Android Studio 4.2.1 启动时出现 NullPointer 异常【英文标题】:Android Studio 4.2.1 NullPointer Exception on startup 【发布时间】:2021-08-17 15:43:45 【问题描述】:

我今天想继续使用 android Studio 开发我的应用程序,但是当我想启动 Android Studio 时,我目前每次都会收到如下所示的错误。我没有更改系统上的任何内容,也没有进行 Java 更新。

我很高兴能得到快速帮助

你好,亚历克斯

Internal error. Please refer to https://code.google.com/p/android/issues

java.lang.NullPointerException
    at java.desktop/javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1524)
    at java.desktop/javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:753)
    at java.desktop/javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:911)
    at java.desktop/javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:890)
    at java.desktop/javax.swing.JComponent.paintComponent(JComponent.java:800)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1077)
    at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5263)
    at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(RepaintManager.java:1654)
    at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1629)
    at java.desktop/javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1566)
    at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1333)
    at java.desktop/javax.swing.JComponent._paintImmediately(JComponent.java:5211)
    at java.desktop/javax.swing.JComponent.paintImmediately(JComponent.java:5021)
    at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:868)
    at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:851)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:851)
    at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:826)
    at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:775)
    at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1901)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:419)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117)
    at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:419)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

-----
JRE 11.0.8+10-b944.6842174 amd64 by N/A
C:\Users\alwe9\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\202.7351085\jre

【问题讨论】:

有助于提供帮助的信息包括操作系统和版本,但您可能还需要考虑 Studio 团队的 filing a bug(该页面上的信息)。 我不认为这个问题可以在 Stack Overflow 上解决(因为上述问题更多是 IDE 技术支持问题)。不过,我可以为遇到同样问题的人提供一些建议(知道我自己也时常会遇到这种情况),您可以简单地使用 IDE 的 内置报告 功能(我相信人们应该能够在这样的每个错误上找到可用的功能),并让 Android Studio IDE 维护人员在下次更新时解决问题。 【参考方案1】:

我可以解决这个问题。它自行修复并在第二天重新启动

【讨论】:

【参考方案2】:

就我而言,这是一个防火墙问题。我知道你说你的计算机上没有任何变化,但我想把它放在这里以防万一它给别人一个线索。

【讨论】:

以上是关于Android Studio 4.2.1 启动时出现 NullPointer 异常的主要内容,如果未能解决你的问题,请参考以下文章

Android Studio启动时出现unable to access android sdk add-on list

Android Studio 启动失败:初始化“com.intellij.util.net.ssl.certificatemanager”时出现致命错误

[转]Android Studio启动时出现unable to access android sdk add-on list

Android Studio错误尝试获取屏幕截图:“从设备获取屏幕截图时出现意外错误:EOF”

Android Studio启动模拟器

将应用程序从 Android Studio 部署到 iPhone 时出现 Flutter 错误