Android Studio无法启动,libjli.dylib太短

时间:2017-05-18 03:48:33

标签: java android-studio intellij-idea preview

无法打开Android Studio 3.0 Preview,我在同一台机器上运行Android Studio 2.3,安装了Java 1.6和Java 1.8,JAVA_HOME配置为1.8版本。这个新的Android Studio版本仍无法打开。

尝试直接从studio文件打开它,我收到以下错误:

allVms required 1.8*,1.8+
Cannot load JVM bundle: Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib): no suitable image found.  Did find:
        /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib: file too short
        /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib: file too short" UserInfo={NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib, NSDebugDescription=dlopen_preflight(/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib): no suitable image found.  Did find:
        /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib: file too short
        /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib: file too short, NSBundlePath=/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk, NSLocalizedDescription=The bundle “OpenJDK 8” couldn’t be loaded because it is damaged or missing necessary resources.}

密切关注这一行:

libjli.dylib: file too short, NSBundlePath=/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk, NSLocalizedDescription=The bundle “OpenJDK 8” couldn’t be loaded because it is damaged or missing necessary resources.}

我试着找到捆绑JDK的一些问题,看起来不错,下载的存档没有问题。有没有人有这样的东西?

1 个答案:

答案 0 :(得分:4)

当我发现问题时,我正打算发布这个问题。

对我来说,问题是MacOS文件夹中的libjli.dylib文件,它不是文件,而是指向真实文件的符号链接,但是当我解压缩它时,它失去了它的属性作为一个符号链接,并成为一个空文件。删除以下文件并创建新的符号链接解决了这个问题。

/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib

这个^家伙链接到这个:

/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jli/libjli.dylib

鉴于您的Android Studio应用位置为/Applications/Android Studio 3.0 Preview.app,我可以使用以下命令解决此问题:

首先删除:

rm /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib

然后创建一个新链接:

ln -s /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jli/libjli.dylib /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib

只需照常打开Android Studio