1

In Java 11 there are some new String methods - strip(), stripLeading() etc. But it is not possible to use them in Android Studio Arctic Fox - when I try to type them, they aren't recognized:

enter image description here

I have Java 11 installed, in Settings the embedded JDK version 11.0.10 is specified:

enter image description here

In the build.gradle file, in compileOptions, I have changed to JavaVersion.VERSION_11:

compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

Why aren't the new methods available?

prosp
  • 97
  • 2
  • 11

1 Answers1

1

I have Java 11 installed, in Settings the embedded JDK version 11.0.10 is specified

That is the version of Java used to run Gradle. It is unrelated to the version of Android that is used on Android devices.

In the build.gradle file, in compileOptions, I have changed to JavaVersion.VERSION_11

That does not change what is on Android devices.

Why aren't the new methods available?

Because Android supports a subset of Java 8.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491