Android设备监视器从Mac上的intellij错误开始

时间:2014-10-15 22:28:17

标签: android macos intellij-idea

尝试从Mac上的Intellij(或Android Studio)启动 Android设备监视器时,结果是一个错误消息对话框告诉

Failed to create the Java Virtual Machine.

当调用... / android-sdk-macosx / tools / monitor(实际上是从intellij中的menue调用)时,错误消息更具体到

Error: could not find libjava.dylib
Failed to GetJREPath()

要在Intellij中调用监视器,需要做些什么?

1 个答案:

答案 0 :(得分:1)

要解决这个问题,你必须做两件事:

  1. 查找或安装包含库libjava.dylib的JRE / JDK,例如:在 / Library / Internet Plug-Ins / JavaAppletPlugin.plugin / Contents / Home / lib
  2. 使监控应用程序能够使用来自1的lib附近的JRE中的java。 / Library / Internet Plug-Ins / JavaAppletPlugin.plugin / Contents / Home / bin
  3. 要解决第一个问题,您可以按照here

    的说明安装JRE

    要解决第二个问题,你必须设置" java"的路径。来自1.)的解释器在文件 ... / android-sdk-macosx / tools / lib / monitor-x86_64 / monitor.app / Contents / Info.plist (对于64位)

    喜欢

    <array>
            <string>-vm</string><string>/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java</string>
            <!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options:
                <string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Commands/java</string>
                <string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java</string>
            -->
            <string>-keyring</string><string>~/.eclipse_keyring</string>
            <string>-showlocation</string>
            <!-- WARNING:
                If you try to add a single VM argument (-vmargs) here,
                *all* vmargs specified in eclipse.ini will be ignored.
                We recommend to add all arguments in eclipse.ini
             -->
    </array>
    

    然后,监控应用程序应该能够创建JVM并运行。