"为什么阿帕奇和谐"或QUOT;如何使用Java 8在Android" [英] "Why Apache Harmony" or "How to use Java 8 on Android"

查看:164
本文介绍了"为什么阿帕奇和谐"或QUOT;如何使用Java 8在Android"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注:我不知道往哪里放了这个问题,它确实看的地方,对的 Android的发烧友的。请原谅我:)

所以,我们大多数人都听过现在的酷功能的Java 8会带来,但Android将不会支持它。这是谷歌使用阿帕奇和谐为Android的原因。这是什么让我们(的Andr​​oid应用程序开发人员)从提高我们的code与lambda表达式,默认情况下实现的接口,在一根绳子上的开关和更多。当然,我们会处理一段时间,但如果我们在我们的应用程序使用了一些图书馆开始使用Java 8的功能?据我所知,这是不行的(请纠正我如果错了)。这之间的标准的-Java和 Android版的-Java造成不兼容。它不可能是谷歌打算,或者至少我想不出理由,为什么一个公司,开发一种被广泛采用的操作系统,将wan't永久留一个的的Java版本。

问题给你:

  • 为什么他们使用Apache和谐?
  • 为什么他们不能采取的Java的新版本?
  • 如果他们不希望甲骨文的Java,为什么他们不能使用的OpenJDK (牌小白这里)?<的一个子集/ LI>
  • 请您知道的任何计划来更新所使用的Java版本?
  • 你知道有什么方法可以在目前的Andr​​oid系统使用Java 8类?

感谢您预先回答任何一个问题。

解决方案
  

为什么他们使用Apache和谐?

由于太阳拒绝按照该是可以接受的条款谷歌提供了Sun(现在是Oracle)的Java许可证。谷歌和Sun谈判,但他们最终从这笔交易中走开。

鸡蛋里挑骨头:事实上,Android的库不是Apache的和谐。他们开始是基于和谐,但两人codebases有分歧。此外,Apache Harmony项目正式成立于2011年11月退役。

  

为什么他们不能采取的Java的新版本?

首先,Android不运行Java(TM)。它运行一种语言,等同于Java的一个类库,在功能上等同于子集的Java类库的(+安卓专用库),在虚拟机上使用的不同的指令集。

从技术的民族性,他们可以......但只有当他们投入了大量的工作,为实现Java 7和Java 8语言特性,库特征等,为Android平台。

更新 - 由于Android的19(奇巧)和Eclipse ADT 22.6,安卓现在是否支持Java 7语言扩展;看到 http://tool​​s.android.com/recent/eclipseadt226$p$pview

  

如果他们不希望甲骨文的Java,为什么他们不能使用的OpenJDK的一个子集?

我不认为转向OpenJDK的将改变什么。甲骨文Java和OpenJDK的是99.9%的相同。

无论如何,有可能是发牌及相关的法律问题。 (并得到一个感觉是,在Oracle VS谷歌提起诉讼......这是要吸引读了起来。)

更可能的是,谷歌并没有看到足够的商业价值,以抵消(块状)的努力,将采取改变,破坏会造成对Android生态系统......它已经从问题碎片受到影响。

  

你知道的任何计划来更新所使用的Java版本?

没有我不知道。这并不意味着,有没有计划,但如果有,他们不是公共

  

你知道有什么方法可以使用​​Java 8班目前的Andr​​oid系统?

您可以将它们移植。或者至少,你可以的尝试的给他们的端口。 (部分的Java API与JVM的本土code面......亲密的关系,并且可以使移植问题。)

Note: I didn't know where to put this question, it did look out of place on Android Enthusiasts. Please forgive me :)

So, most of us have heard by now of the cool features Java 8 will bring, but Android will not support it. This is because of Google using Apache Harmony for Android. This is what is keeping us (the android app developers) from improving our code with lambdas, default implementations in interfaces, switching on a String and a lot more. Surely, we will handle for some time, but what if some libraries we use in our apps start to use Java 8 features? As far as I know, this will not work (please correct me if wrong). This creates incompatibility between Standard-Java and Android-Java. It cannot be what Google intends, or at least I can't think of a reason why a company, developing a widely adopted operating system, would wan't to permanently stay with an old Java version.

Questions to you:

  • Why do they use Apache Harmony?
  • Why can't they adopt a newer version of java?
  • If they don't want Oracle's Java, why can't they use a subset of OpenJDK (licensing noob here)?
  • Do you know of any plans to update the used Java version?
  • Do you know of any way to use Java 8 classes on current Android systems?

Thank you in advance for answering any of these questions.

解决方案

Why do they use Apache Harmony?

Because Sun refused to provide Google with a license for Sun (now Oracle) Java under terms that were acceptable. Google and Sun negotiated, but they ended up walking away from the deal.

Nitpick: in fact, the Android libraries are not Apache Harmony. They started out as based on Harmony, but the two codebases have diverged. Furthermore, the Apache Harmony project was officially "retired" in November 2011.

Why can't they adopt a newer version of java?

Firstly, Android does not run Java(tm). It runs a language that is identical to Java with a class library that is functionally equivalent to a subset of the Java class library (+ Android-specific libraries), on a virtual machine with a different instruction set.

From a technical pespective, they could ... but only if they put in a lot of work into implementing Java 7 and Java 8 language features, library features, etc, for the Android platform.

UPDATE - As of Android 19 (KitKat) and Eclipse ADT 22.6, Android does now support the Java 7 language extensions; see http://tools.android.com/recent/eclipseadt226preview

If they don't want Oracle's Java, why can't they use a subset of OpenJDK?

I don't think that switching to OpenJDK would change anything. Oracle Java and OpenJDK are 99.9% the same.

Anyway, there may be licensing and related legal issues. (And to get a feel for that, read up on the Oracle vs Google lawsuit ... that is going to appeal.)

More likely, Google doesn't see enough commercial value to counteract the (massive) effort it would take to change, and the disruption it would cause to the Android ecosystem ... which already suffers from problems with fragmentation.

Do you know of any plans to update the used Java version?

No I don't. It doesn't mean that there aren't plans, but if there are, they are not public.

Do you know of any way to use Java 8 classes on current Android systems?

You could port them. Or at least, you could try to port them. (Some Java APIs have an intimate relationship with the native code side of the JVM ... and that could make porting problematic.)

这篇关于&QUOT;为什么阿帕奇和谐&QUOT;或QUOT;如何使用Java 8在Android&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆