I know there are a lot of questions on here about Android API Level and Version but this question is different so please don't mark it as a duplicate.
I am wondering how Java version 1.6, 1.7, 1.8... relates to those two. The source of my confusion is me trying to use the Pattern.compile
method with the Pattern.UNICODE_CHARACTER_CLASS
flag as seen below.
Pattern pattern = Pattern.compile("\b" + keywordToCheck + "\b", Pattern.UNICODE_CHARACTER_CLASS);
From the docs on Pattern.UNICODE_CHARACTER_CLASS
it says that it says Since: 1.7, which I assume to mean it is available in Java version 1.7 and above. I am trying to use that line of code in an Android project but every time I run it on my device I get:
java.lang.IllegalArgumentException: Unsupported flags: 256
Below are the relevant parts of my build.gradle file
defaultConfig {
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
From my understanding this means my app will use any API level 19 and above, which means it can run on Android 4.4 (KitKat) or higher. The device I'm running the app on has Android 6.0. How does the Java version fit into this? I am using Android Studio 3.0 which says I'm using:
Android Studio 3.0
Build #AI-171.4408382, built on October 20, 2017
JRE: 1.8.0_152-release-915-b08 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6
Can someone explain to me why I'm getting this error, and also the relationship between Android API Level, Version, and Java version? Thank you
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…