What technical obstacle for Android not support the new versions of Java

Asked

Viewed 117 times

0

I wonder why the version of java in the Android remains the same after so many years. Against Kotlin update with a certain frequency, it is a technical issue the stagnation of Java?

  • 1

    Related: https://answall.com/q/190247/2541

3 answers

4

None, or almost. The biggest reason is probably cost. It is expensive to implement all these novelties. And it is clear that Google is not investing more in Java. For her you should use Kotlin. One of the reasons is that it is being sued by Oracle, and has great chance of losing definitely, already lost before. You will have to pay a billion dollar for creating your own Java implementation and the best way out for them can be to get rid of the language. Why keep investing in something she’ll have trouble using?

It still does, some novelties of Java that were simple to implement implemented. Some of these novelties need to be linked to use. I don’t know if they will support forever so they don’t leave on by default. It supports a lot of new stuff, but it takes a while to implement.

In fact there is one or another point in the library that may have some incompatibilities, Google anticipated and then came something official that was different, but I do not know if something relevant.

The safest way is to adopt Kotlin. If Google now does dog food with Kotlin you must do too. She will not speak clearly if she is preparing to abandon at least a partial solution, but her actions clearly indicate this.

  • If I’m right, and correct me if I am, does Kotlin run on top of the Java JVM, is JVM open source? And it can be used by other languages like Kotlin, no problem?

  • Yes on some platforms, but not on Android, it uses Android Runtime (ART). Both are open.

4


First, researching, I found nothing talking directly about technical obstacles, but on the topic of this answer on Java 8 you will see something about this point.

Kotlin and Java

I will complement here some points mentioned by @Maniero, so read his reply as well :).

1. Kotlin is Open source, Java is from Oracle

Java is a proprietary language while Kotlin is a language Open Source, what goes against the mentality of Android, which is also an Open Source project. At Android developers, you can find confirmation of what was said above:

Kotlin is a free open source Apache license project 2.0. Development and distribution as free software is guaranteed by the Kotlin Foundation. Kotlin’s choice reaffirms our commitment to an open development ecosystem as expanded the Android platform. In addition, we look forward to seeing the evolving language.

2. Kotlin and Java in the same project

A cool fact about Kotlin and Java is that you can start migrating a Java project to Kotlin without having to migrate everything at once, since the code in Kotlin ends up being compiled into Java code.

Interoperable

Call Java-based code with Kotlin or call Kotlin with code Java-based. Kotlin is fully interoperable with java programming language. Therefore, it is possible to have as much of Kotlin you want in your project.

3. Google and the Kotlin first approach

To Google announced which went on to develop on Android with an approach Kotlin first in the Google I/O 2019. There was a slide with the title Kotlin first: Why? (minute 25:48 video) explaining benefits (in the eyes of Google) of Kotlin in relation to Java.

Kotlin first: Why?

  • Strong adoption and community excitement
  • Developers are Much happier using Kotlin
  • It is Battle-tested
  • Customers feedback: Focus Investments on Kotlin

So I talked a lot about Kotlin here, but that’s because this is why Google is investing more in Kotlin than in Java.

Java 8

You’re probably still thinking "And why does the Java version stay the same?". If you read about Using Java 8 language resources you will find the following:

Android Studio 3.0 and newer versions are compatible with all features of the Java 7 language and with a subset of Java 8 language, which vary by platform version.

(...)

Android Studio is not compatible with all features of Java 8 language, but this compatibility is being expanded in future versions of the integrated development environment. Depending on of the minSdkVersion used, some features and Apis are already available (...).

That’s probably the closest thing to technical obstacle that we have. The fact that Android Studio needs to support the functionality of the new Java versions and adapt it to all Android SDK.

Then I must stop using Java?

"If Google is doing things first in Kotlin, I should too, right? Java will die on Android!"

Almost. It makes sense to start doing things in Kotlin because it’s getting more support from Google today. Not it makes sense to say that you must stop doing things with Java and migrate all your current applications for fear they will stop working. In Google I/O 2019 there was the following sentence (minute 26:23 of the video):

Of Course, we’re going to Keep supporting the Java Programming language in Many aspects. Platform, Android Studio Support, Lint, like Docs, Androidx, that’s not going away.

So, it is worth migrating to Kotlin and start doing things in Kotlin, but there is no abandonment speech to Java. Watch the entire video, I just highlighted small points in that reply.

0

Android has been following Java updates. In one project you can use both the latest version of Java and Kotlin.

The fact that Kotlin has say "a more affectionate accompaniment", is because it has become the official language for Android application development. Anyway you can use Java in its latest version.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.