【问题标题】:Missing Constraint when opening Android Device Monitor打开 Android 设备监视器时缺少约束
【发布时间】:2016-03-19 01:13:50
【问题描述】:

当启动monitor 时,它会崩溃并将以下内容写入其日志文件:

org.osgi.framework.BundleException: The bundle "org.eclipse.core.runtime_3.8.0.v20120912-155025 [44]" could not be resolved. Reason: Missing Constraint: Bundle-    RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,J2SE-1.3
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.equinox.common 4 0 2016-03-18 10:50:26.908
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.common_3.6.100.v20120522-1841 [83]" could not be resolved. Reason: Missing Constraint: Bundle-  RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,J2SE-1.4
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.osgi 4 0 2016-03-18 10:50:26.964
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.core.runtime_3.8.0.v20120912-155025.jar was not resolved.

!ENTRY org.eclipse.osgi 4 0 2016-03-18 10:50:26.965
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.common_3.6.100.v20120522-1841.jar was not resolved.

!ENTRY org.eclipse.osgi 4 0 2016-03-18 10:50:26.968
!MESSAGE Could not start bundle: org.eclipse.equinox.console
!STACK 0
org.osgi.framework.BundleException: Could not start bundle: org.eclipse.equinox.console
    at org.eclipse.osgi.framework.internal.core.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:217)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:297)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:520)
    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)
Caused by: org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.console_1.0.0.v20120522-1841 [84]" could not be resolved. Reason: Missing Constraint: Bundle-    RequiredExecutionEnvironment: J2SE-1.5
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
    at org.eclipse.osgi.framework.internal.core.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:215)
    ... 9 more
Root exception:
org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.console_1.0.0.v20120522-1841 [84]" could not be resolved. Reason: Missing Constraint: Bundle-   RequiredExecutionEnvironment: J2SE-1.5
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
    at org.eclipse.osgi.framework.internal.core.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:215)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:297)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:520)
    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)

我在 Mac OSX 10.9.5 上运行 Java 7:

$ java -version
  java version "1.7.0_71"

【问题讨论】:

  • 看起来像 Eclipse 错误。我可能会重新安装 Eclipse
  • 这是Android Device Monitor,似乎使用了Eclipse插件。我没有安装 Eclipse,也不是使用这个工具的先决条件
  • @AmandeepGrewal 这里可能是同样的问题。你找到解决办法了吗?
  • 在 Linux 上使用 Android Studio 和 Android Device Monitor 时同样的问题
  • 今天同样的问题 :( 2018 年仍然没有找到答案

标签: android eclipse


【解决方案1】:

我找到了这个并且它有效:https://gist.github.com/sshnakamoto/074b5428a25b467e4402d97ded02be9d

  1. 运行命令:

/usr/libexec/java_home -V 结果应如下所示:

9.0.4, x86_64:    "Java SE 9.0.4" /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
1.8.0_144, x86_64:    "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
  1. 如果您在结果中看到 Java 9,则禁用:

首先导航到 /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/然后重命名 Info.plist -> Info.disabled.plist

  1. 验证 Java 9 是否已禁用:

重新运行/usr/libexec/java_home -V,您应该不再看到 Java 9 列出的版本

对我来说,有一个 Java 11。

【讨论】:

    【解决方案2】:

    我通过删除 Java 9 并安装 Java 8 来实现这一点

    我在 Mac 上运行了这个

    sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin

    然后安装 Java 8

    brew cask install caskroom/versions/java8

    【讨论】:

      【解决方案3】:

      我设法通过编辑重新启动 Android Monitor(作为 VisualStudio for Mac 的一部分):

      <user's>/Library/Developer/Xamarin/android-sdk-macosx/tools/lib/monitor-x86_64/monitor.app/Contents/Info.plist
      

      并取消注释该行下面的一行:

      > to use a specific Java version (instead of the platform's default)
      > uncomment one of the following options
      

      并添加了一行,其中包含机器上旧 JDK/JRE 版本的路径。就我而言,JDK 1.8。看起来像:

      <string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin/java</string>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-03-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-02-16
        相关资源
        最近更新 更多