Android studio 4.2 找不到模拟器、设备或 AVD 管理器
Android studio 4.2 doesn't find emulators, devices or AVD Manager
我刚刚将 Android Studio 从 4.1.3 更新到 4.2。
现在,它找不到任何模拟器,甚至找不到我的手机 phone。它显示一条消息“正在加载设备”。
另外,当我点击 AVD Manager 时,它没有打开。它向我显示了这个错误:
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:419)
at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:411)
at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:369)
at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
at com.android.dvlib.DeviceSchema.getXmlSchemaVersion(DeviceSchema.java:398)
at com.android.sdklib.devices.DeviceParser.parseImpl(DeviceParser.java:496)
at com.android.sdklib.devices.DeviceParser.parse(DeviceParser.java:481)
at com.android.sdklib.devices.DeviceManager.initDefaultDevices(DeviceManager.java:287)
at com.android.sdklib.devices.DeviceManager.initDevicesLists(DeviceManager.java:265)
at com.android.sdklib.devices.DeviceManager.getDevice(DeviceManager.java:198)
at com.android.sdklib.internal.avd.AvdManager.parseAvdInfo(AvdManager.java:1451)
at com.android.sdklib.internal.avd.AvdManager.buildAvdList(AvdManager.java:1337)
at com.android.sdklib.internal.avd.AvdManager.<init>(AvdManager.java:402)
at com.android.sdklib.internal.avd.AvdManager.getInstance(AvdManager.java:443)
at com.android.tools.idea.avdmanager.AvdManagerConnection.initIfNecessary(AvdManagerConnection.java:211)
at com.android.tools.idea.avdmanager.AvdManagerConnection.getAvds(AvdManagerConnection.java:333)
at com.android.tools.idea.avdmanager.AvdDisplayList.refreshAvds(AvdDisplayList.java:230)
at com.android.tools.idea.avdmanager.AvdDisplayList.<init>(AvdDisplayList.java:194)
at com.android.tools.idea.avdmanager.AvdListDialog.<init>(AvdListDialog.java:43)
at org.jetbrains.android.actions.RunAndroidAvdManagerAction.openAvdManager(RunAndroidAvdManagerAction.java:74)
at org.jetbrains.android.actions.RunAndroidAvdManagerAction.actionPerformed(RunAndroidAvdManagerAction.java:65)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:282)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:276)
at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:182)
at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:155)
at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:439)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access0(EventQueue.java:97)
at java.awt.EventQueue.run(EventQueue.java:709)
at java.awt.EventQueue.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at
OS: macOS 大苏尔 - 11.2.3
我已经尝试卸载 android Studio 并重新安装。
我已经安装了 SDK 工具选项卡上的所有内容,以及 3 个不同的 SDK 平台。
我也遇到过同样的问题。最后我找到了以下解决方案:在 Preferences 文件夹中(在我的 Mac ~/Library/Application Support/Google/AndroidStudio4.2 上)有一个文件 studio.jdk 指向 Java 8 版本。我编辑了该文件,并将其替换为较新的版本(在我的例子中为 /Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk)。然后 avdmanager 开始在 Android Studio 4.2.
中工作
我已在 Google 的问题跟踪器上提交了以下问题:https://issuetracker.google.com/issues/187890146。如果您遇到过这个问题,请加星标。
我刚刚将 Android Studio 从 4.1.3 更新到 4.2。
现在,它找不到任何模拟器,甚至找不到我的手机 phone。它显示一条消息“正在加载设备”。
另外,当我点击 AVD Manager 时,它没有打开。它向我显示了这个错误:
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:419)
at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:411)
at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:369)
at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
at com.android.dvlib.DeviceSchema.getXmlSchemaVersion(DeviceSchema.java:398)
at com.android.sdklib.devices.DeviceParser.parseImpl(DeviceParser.java:496)
at com.android.sdklib.devices.DeviceParser.parse(DeviceParser.java:481)
at com.android.sdklib.devices.DeviceManager.initDefaultDevices(DeviceManager.java:287)
at com.android.sdklib.devices.DeviceManager.initDevicesLists(DeviceManager.java:265)
at com.android.sdklib.devices.DeviceManager.getDevice(DeviceManager.java:198)
at com.android.sdklib.internal.avd.AvdManager.parseAvdInfo(AvdManager.java:1451)
at com.android.sdklib.internal.avd.AvdManager.buildAvdList(AvdManager.java:1337)
at com.android.sdklib.internal.avd.AvdManager.<init>(AvdManager.java:402)
at com.android.sdklib.internal.avd.AvdManager.getInstance(AvdManager.java:443)
at com.android.tools.idea.avdmanager.AvdManagerConnection.initIfNecessary(AvdManagerConnection.java:211)
at com.android.tools.idea.avdmanager.AvdManagerConnection.getAvds(AvdManagerConnection.java:333)
at com.android.tools.idea.avdmanager.AvdDisplayList.refreshAvds(AvdDisplayList.java:230)
at com.android.tools.idea.avdmanager.AvdDisplayList.<init>(AvdDisplayList.java:194)
at com.android.tools.idea.avdmanager.AvdListDialog.<init>(AvdListDialog.java:43)
at org.jetbrains.android.actions.RunAndroidAvdManagerAction.openAvdManager(RunAndroidAvdManagerAction.java:74)
at org.jetbrains.android.actions.RunAndroidAvdManagerAction.actionPerformed(RunAndroidAvdManagerAction.java:65)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:282)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:276)
at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:182)
at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:155)
at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:439)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access0(EventQueue.java:97)
at java.awt.EventQueue.run(EventQueue.java:709)
at java.awt.EventQueue.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at
OS: macOS 大苏尔 - 11.2.3
我已经尝试卸载 android Studio 并重新安装。
我已经安装了 SDK 工具选项卡上的所有内容,以及 3 个不同的 SDK 平台。
我也遇到过同样的问题。最后我找到了以下解决方案:在 Preferences 文件夹中(在我的 Mac ~/Library/Application Support/Google/AndroidStudio4.2 上)有一个文件 studio.jdk 指向 Java 8 版本。我编辑了该文件,并将其替换为较新的版本(在我的例子中为 /Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk)。然后 avdmanager 开始在 Android Studio 4.2.
中工作我已在 Google 的问题跟踪器上提交了以下问题:https://issuetracker.google.com/issues/187890146。如果您遇到过这个问题,请加星标。