Android Studio 3.0 rc2:Android 设备监视器无法打开

Android Studio 3.0 rc2: Android Device Monitor failed to open

我最近使用应用程序内更新部分的 Beta 通道将我的 Android Studio 更新到 3.0 rc2。

今天我想使用 Android 设备监视器,其中发生异常并保存到 sdk 文件夹中的日志。

日志是这样的:

!SESSION 2017-10-28 19:28:26.756 -----------------------------------------------
eclipse.buildId=unknown
java.version=9-ea
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -data @noDefault

!ENTRY org.eclipse.osgi 4 0 2017-10-28 19:28:27.267
!MESSAGE error loading hook: org.eclipse.osgi.internal.baseadaptor.BaseHookConfigurator
!STACK 0
java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @4abdb505
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Unknown Source)
    at java.base/java.lang.reflect.Method.setAccessible(Unknown Source)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.findMethod(BaseStorage.java:174)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.findMethod(BaseStorage.java:181)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.findAddURLMethod(BaseStorage.java:165)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.<init>(BaseStorage.java:135)
    at org.eclipse.osgi.internal.baseadaptor.BaseHookConfigurator.addHooks(BaseHookConfigurator.java:24)
    at org.eclipse.osgi.baseadaptor.HookRegistry.loadConfigurators(HookRegistry.java:178)
    at org.eclipse.osgi.baseadaptor.HookRegistry.initialize(HookRegistry.java:100)
    at org.eclipse.osgi.baseadaptor.BaseAdaptor.<init>(BaseAdaptor.java:98)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.createAdaptor(EclipseStarter.java:737)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:258)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

!ENTRY org.eclipse.osgi 4 0 2017-10-28 19:28:27.309
!MESSAGE Startup error
!STACK 1
java.lang.NullPointerException
    at org.eclipse.osgi.baseadaptor.BaseAdaptor.initializeStorage(BaseAdaptor.java:123)
    at org.eclipse.osgi.framework.internal.core.Framework.<init>(Framework.java:192)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:262)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

我不知道如何处理这个错误,我需要一种解决方法。 我很乐意提出解决问题的任何建议,而无需提及 "download stable version" 和降级。

更新: 在我尝试通过更新部分的稳定通道更新到稳定版本后,我收到一些文件丢失的错误

gradle/m2repository/com/android/java/
gradle/m2repository/com/android/java/tools/
gradle/m2repository/com/android/java/tools/build/
gradle/m2repository/com/android/java/tools/build/java-lib-model-builder/
gradle/m2repository/com/android/java/tools/build/java-lib-model/

我正在尝试更新每个模块,也许我可以解决这个问题

UPDATE-2: 取消之前的错误并 运行 启用 Android Studio 后,似乎已更新但错误仍然存​​在,这是更新到稳定版本后的错误:

!SESSION 2017-10-28 19:55:04.560 -------------------------------------------
----
eclipse.buildId=unknown
java.version=9-ea
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -data @noDefault

!ENTRY org.eclipse.osgi 4 0 2017-10-28 19:55:04.922
!MESSAGE error loading hook: org.eclipse.osgi.internal.baseadaptor.BaseHookConfigurator
!STACK 0
java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @4abdb505
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Unknown Source)
    at java.base/java.lang.reflect.Method.setAccessible(Unknown Source)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.findMethod(BaseStorage.java:174)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.findMethod(BaseStorage.java:181)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.findAddURLMethod(BaseStorage.java:165)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.<init>(BaseStorage.java:135)
    at org.eclipse.osgi.internal.baseadaptor.BaseHookConfigurator.addHooks(BaseHookConfigurator.java:24)
    at org.eclipse.osgi.baseadaptor.HookRegistry.loadConfigurators(HookRegistry.java:178)
    at org.eclipse.osgi.baseadaptor.HookRegistry.initialize(HookRegistry.java:100)
    at org.eclipse.osgi.baseadaptor.BaseAdaptor.<init>(BaseAdaptor.java:98)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.createAdaptor(EclipseStarter.java:737)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:258)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

!ENTRY org.eclipse.osgi 4 0 2017-10-28 19:55:04.959
!MESSAGE Startup error
!STACK 1
java.lang.NullPointerException
    at org.eclipse.osgi.baseadaptor.BaseAdaptor.initializeStorage(BaseAdaptor.java:123)
    at org.eclipse.osgi.framework.internal.core.Framework.<init>(Framework.java:192)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:262)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

UPDATE-3: 经过大量搜索,我找到了解决方案,但这不是答案,所以我将此更新添加到问题中。

我可以通过 cmd 或 powershell 转到 /sdk/tools/ 和 运行 monitor.bat 文件来手动 运行 Android 设备监视器,现在我有访问此功能,但即使是现在,Android Studio 也无法为我打开它!!!! 请如果有人可以帮助我 post 一个答案告诉我这个问题的解决方法。

如果您在 windows 上,请尝试在管理模式下打开您的 Android Studio(运行 作为管理员)

经过多次尝试和捕捉!我终于解决了这个问题。 Android Studio 3.0 不完全支持 JDK 9 在我的系统上安装 JDK 8 并将其设置为 JAVA_HOME 变量并重新启动系统后,现在一切正常。 我得到它是因为我想安装 Nativescript 但我不能因为它只支持 JDK 8。这是我的第一个线索

设置JAVA_HOME变量到JDK8目录就可以了