在 Ubuntu 10.10 上使用 Android SDK 真的需要 Sun Java 吗?我更喜欢 OpenJDK

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4074711/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 04:40:37  来源:igfitidea点击:

Is Sun Java really necessary for using Android SDK on Ubuntu 10.10? I prefer OpenJDK

javaandroidopenjdk

提问by MountainX

I would prefer to just use openjdk-6-jdk(version 6b20-1.9.1-1ubuntu3). But I'm just starting the Android SDK installation, so if Sun (Oracle) Java is really needed, I suppose now is the time to install it. Any advice?

我宁愿只使用openjdk-6-jdk(版本 6b20-1.9.1-1ubuntu3)。但我刚刚开始安装 Android SDK,所以如果真的需要 Sun (Oracle) Java,我想现在是安装它的时候了。有什么建议吗?

采纳答案by ykatchou

I'm using JDK for working on Android and it's fine :)

我正在使用 JDK 在 Android 上工作,这很好:)

java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.1) (6b20-1.9.1-1ubuntu3)
OpenJDK 64-Bit Server VM (build 17.0-b16, mixed mode)

And eclipse plugin too :)

还有 eclipse 插件:)

回答by MountainX

I tried it and it is working. I built and ran my project without any errors. (If I encounter errors in the future, I'll know to try the Sun JDK.)

我试过了,它正在工作。我构建并运行了我的项目,没有任何错误。(如果我以后遇到错误,我会知道尝试 Sun JDK。)

Thanks for the feedback.

感谢您的反馈。

BTW, I'm running Ubuntu 10.10, and Eclipse Helios Service Release 1 Build id: 20100917-0705 My project targets Android 2.2. It works so far.

顺便说一句,我正在运行 Ubuntu 10.10 和 Eclipse Helios Service Release 1 Build id:20100917-0705 我的项目面向 Android 2.2。到目前为止它有效。

回答by CommonsWare

But I'm just starting the Android SDK installation, so if sun java is really needed, I suppose now is the time to install it. Any advice?

但是我刚刚开始安装Android SDK,所以如果真的需要sun java,我想现在是安装它的时候了。有什么建议吗?

The Dalvik cross-compiler expects Sun bytecode and will fail with OpenJDK-generated class files, by all reports. Also, I'm not sure if there are any issues with other tools, such as the Eclipse ADT plug-in. You are welcome to try it, though.

根据所有报告,Dalvik 交叉编译器需要 Sun 字节码,并且会因 OpenJDK 生成的类文件而失败。另外,我不确定其他工具(例如 Eclipse ADT 插件)是否存在任何问题。不过,欢迎您尝试。

OpenJDK and the official Oracle compilers work using modern versions of the Android developer tools. Other Java compilers (e.g., GNU Classpath for Java) may or may not work.

OpenJDK 和官方 Oracle 编译器使用现代版本的 Android 开发人员工具工作。其他 Java 编译器(例如,用于 Java 的 GNU Classpath)可能会也可能不会。

回答by serv-inc

For an "official" answer(by Andrew Hughes, who is "Free Java Software Engineer" at Red Hat, Inc):

对于“官方”答案(由 Red Hat, Inc 的“自由 Java 软件工程师”Andrew Hughes 提供):

We've never had any bug reports relating to this that I'm aware of.

据我所知,我们从未收到任何与此相关的错误报告。