Android studio 4.2 找不到模拟器、设备或 AVD 管理器
Posted
技术标签:
【中文标题】Android studio 4.2 找不到模拟器、设备或 AVD 管理器【英文标题】:Android studio 4.2 doesn't find emulators, devices or AVD Manager 【发布时间】:2021-07-29 01:53:20 【问题描述】:我刚刚将 android Studio 从 4.1.3 更新到 4.2。
现在,它找不到任何模拟器甚至我的手机。它显示一条消息“正在加载设备”。
另外,当我点击 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.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at
操作系统:macOS Big Sur - 11.2.3
我已经尝试卸载 android studio 并重新安装。
我已经在 SDK 工具选项卡和 3 个不同的 SDK 平台上安装了所有内容。
【问题讨论】:
这一行java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
我认为一些安全原因或权限访问检查
【参考方案1】:
我也曾遇到过同样的问题。最后我找到了以下解决方案:在 Preferences 文件夹中(在我的 Mac ~/Library/Application Support/Google/AndroidStudio4.2 上)有一个指向 Java 8 版本的文件 studio.jdk。我编辑了文件,并将其替换为较新的版本(在我的例子中是 /Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk)。然后 avdmanager 开始在 Android Studio 4.2 中工作。
我在 Google 的问题跟踪器上提交了以下问题:https://issuetracker.google.com/issues/187890146。如果您遇到此问题,请加注星标。
【讨论】:
以上是关于Android studio 4.2 找不到模拟器、设备或 AVD 管理器的主要内容,如果未能解决你的问题,请参考以下文章
关于Android Studio自带的模拟器处于运行中但找不到的问题