错误:处理'命令'/usr/local/android-studio/jre/bin/java'' 以非零退出值 2 结束
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41426033/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error:Process 'command '/usr/local/android-studio/jre/bin/java'' finished with non-zero exit value 2
提问by Alberto Venturi
Android Studio 2.2.3;
Java 8;
Ubuntu 14.10;
laptop: Asus K72F.
安卓工作室 2.2.3;
爪哇 8;
Ubuntu 14.10;
笔记本电脑:华硕K72F。
I spent no less than twenty hours on a Udacity course, learning the basics of XML as part of an Android course.
我在 Udacity 课程上花了不少于 20 个小时,在 Android 课程中学习 XML 的基础知识。
I installed Java on my Ubuntu machine, then Android Studio IDE.
我在我的 Ubuntu 机器上安装了 Java,然后是 Android Studio IDE。
Followed instructions on the course's videos and pages. Tried saving my first project, but never made it to the first step...
按照课程视频和页面上的说明进行操作。尝试保存我的第一个项目,但从未完成第一步...
Error:Process 'command '/usr/local/android-studio/jre/bin/java'' finished with non-zero exit value 2
错误:处理'命令'/usr/local/android-studio/jre/bin/java'' 以非零退出值 2 结束
I've found no intelligible instructions on the web.
我在网上没有找到可理解的说明。
I've been using Ubuntu, Linux, Mac OS X and Unix for ten years now, and I've solved one or two hundred problems with and without the command line, most often copying and pasting from Stack Overflow pages.
我已经使用 Ubuntu、Linux、Mac OS X 和 Unix 十年了,我已经解决了有和没有命令行的一两百个问题,最常见的是从 Stack Overflow 页面复制和粘贴。
I've explored menus on Android Studio, I've opened lib folders. Some posts suggested changing libraries but failed to mention which ones and how.
我在 Android Studio 上浏览过菜单,我打开了 lib 文件夹。一些帖子建议更改库,但没有提及哪些库以及如何更改库。
Another post suggested changing "overrides" but, without a sealed project, Code > Override Methods stays grey and I can't act on it ... Another vicious circle.
另一篇文章建议更改“覆盖”,但是,如果没有密封的项目,代码 > 覆盖方法保持灰色,我无法对其采取行动......另一个恶性循环。
One post suggested downgrading to Java 7. I thought the IDE setup for the Linux community might be slightly old, so I uninstalled Java 8 and got Java 7. Got rid of the IDE folder and reinstalled Android Studio, but this time I put it in /usr/local to play it safer. No, Java 7 wasn't supported so I had to upgrade and go back to Java 8.
一个帖子建议降级到Java 7。我认为Linux社区的IDE设置可能有点旧,所以我卸载了Java 8并获得了Java 7。摆脱了IDE文件夹并重新安装了Android Studio,但这次我把它放在了/usr/local 以使其更安全。不,Java 7 不受支持,所以我不得不升级并返回到 Java 8。
I've been stuck for three weeks now. Yesterday I tried installing the latest version of this IDE on Windows but there's a bug and it crashes before opening.
我已经被困了三个星期了。昨天我尝试在 Windows 上安装这个 IDE 的最新版本,但是有一个错误,它在打开之前崩溃了。
I would appreciate it if you could state instructions taking nothing for granted, I am an absolute beginner with Android and gradle and the jargon is overwhelmingly different from Unix.
如果您能说明任何事情都是理所当然的,我将不胜感激,我是 Android 和 gradle 的绝对初学者,行话与 Unix 截然不同。
This reminds of the time when everybody suggested opening a Terminal window but nobody said how.
这让我想起每个人都建议打开终端窗口但没有人说如何打开的时代。
Please tell me which menus I have to go to, what lines to change, or which libraries to change and where to fetch them. Thank you for your time and trouble!
请告诉我我必须转到哪些菜单,要更改哪些行,或者要更改哪些库以及从何处获取它们。感谢您的时间和麻烦!
回答by Matej Mari?
I had the same problem, but when I entered good java path, I had a different problem, searched the solution for 3 days, and finally, this video gave me the answer...
我也遇到了同样的问题,但是当我进入好的java路径时,我遇到了不同的问题,搜索了3天的解决方案,最后,这个视频给了我答案......
Good luck!!
祝你好运!!
https://www.youtube.com/watch?v=zhj3MY4SpHY
https://www.youtube.com/watch?v=zhj3MY4SpHY
EDITED:
编辑:
So, the process looks like this. 1) after you download android studio and extract it to either /usr/local/ or /opt/, run it. When it gradles, you'll see an error "process 'command' /usr/loca/android-studio/jre/bin/java finished with non-zero exit value 2"
所以,这个过程看起来像这样。1) 在您下载 android studio 并将其解压缩到 /usr/local/ 或 /opt/ 后,运行它。当它渐变时,你会看到一个错误“进程‘命令’/usr/loca/android-studio/jre/bin/java 以非零退出值 2 完成”
2) go to File->Project Structure->SDK Location an in there uncheck "Use embedded JDK". in the input field below that checkbox, paste or choose tha path of your JDK (mine was /usr/lib/jvm/java-8-jdk).
2) 转到文件-> 项目结构-> SDK 位置,然后取消选中“使用嵌入式 JDK”。在该复选框下方的输入字段中,粘贴或选择 JDK 的路径(我的是 /usr/lib/jvm/java-8-jdk)。
3) Click OK, let gradle to do it's work, and when it's finished, you'll get 2 more errors (which I'm not gonna paste here) with lagre log (if you look at the log, on the beginning you should see something about unclosed quotes in aapt file in your /build-tools/25.0.0/aapt).
3)点击OK,让gradle完成它的工作,当它完成时,你会得到2个错误(我不会在这里粘贴)和lagre日志(如果你查看日志,在开始时你应该在 /build-tools/25.0.0/aapt 中的 aapt 文件中查看有关未闭合引号的信息)。
4) !!!! I did this step to make sure that I have the same error like in the video, so it is optional !!!! I did a rebuild or clean. in the menu go to Build->Rebuild and start it. Your gradle should run forever so you can wait for a few minutes and if it's not finished, shut android studio down and proceed to the step 5. If your gradle finishes, it's probablly not the error I'm tryng to expain.
4) !!!!!! 我执行此步骤是为了确保我有与视频中相同的错误,因此它是可选的!!!!我做了重建或清理。在菜单中转到 Build-> Rebuild 并启动它。你的 gradle 应该永远运行,所以你可以等待几分钟,如果它没有完成,关闭 android studio 并继续第 5 步。如果你的 gradle 完成,这可能不是我试图解释的错误。
5) When this is all done, opet the folder where your android apps are stored (for me the path is /home/matej/AndroidStudioProjects/MyApp/app), open your app (App name)->app->build.gradle
5)当这一切都完成后,打开你的安卓应用程序所在的文件夹(对我来说路径是/home/matej/AndroidStudioProjects/MyApp/app),打开你的应用程序(应用程序名称)->app->build.gradle
6) change the line "buildToolsVersion '25.0.2'" to "buildToolsVersion '23.0.1'", save it and close
6) 将“buildToolsVersion '25.0.2'”行更改为“buildToolsVersion '23.0.1'”,保存并关闭
7) run the android studio again and you'll see the message where it links you to the installation of the missing build tools. click on it, install it and clean your project
7) 再次运行 android studio,您将看到一条消息,其中将您链接到缺少的构建工具的安装。单击它,安装它并清理您的项目
8) ENJOY IN DEVELOPING :)
8) 享受发展 :)
回答by Debasish Ghosh
In my case, I had firebase database gradle versin lower than the latest one. Changing it to latest solved the issue.
就我而言,我的 firebase 数据库 gradle 版本低于最新版本。将其更改为最新解决了该问题。