简体   繁体   English

Android 使用 launchctl 构建时构建失败

[英]Android builds fail when building with launchctl

I am trying to write a script to automate my build process and push builds every so often.我正在尝试编写一个脚本来自动化我的构建过程并经常推送构建。 So ever everything seems to be working except for my JAVA_HOME environment variable.因此,除了我的 JAVA_HOME 环境变量之外,一切似乎都在工作。

When building the app normally from command line I specify my JAVA_HOME as:从命令行正常构建应用程序时,我将 JAVA_HOME 指定为:

/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home

However if I add this as an environment variable to my launchctl.plist I get the following error:但是,如果我将它作为环境变量添加到我的 launchctl.plist 中,我会收到以下错误:

ERROR: JAVA_HOME is set to an invalid directory: /Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home

This directory does exist and works fine when building the app normally.这个目录确实存在并且在正常构建应用程序时工作正常。 If I do not specify the JAVA_HOME then I get the following error on building my app:如果我没有指定 JAVA_HOME,那么在构建我的应用程序时会出现以下错误:

General error during semantic analysis: Unsupported class file major version 60.

Is there something I am doing wrong or can change to allow launchd to either build without the specified JAVA_HOME or to recognize the JAVA_HOME I am setting?我做错了什么或者可以更改以允许 launchd 在没有指定 JAVA_HOME 的情况下构建或识别我正在设置的 JAVA_HOME?

Add the code below to your environment's path .zshenv file in your home directory.将以下代码添加到您的主目录中您的环境路径.zshenv文件中。

Run source ~/.zshenv to update terminal or Quit the terminal and reopen it again运行source ~/.zshenv以更新终端或退出终端并重新打开它

Android Studio Dolphin and below: Android Studio Dolphin及以下:

export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home

Android Studio Electric Eel and above: Android工作室电鳗及以上:

export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM