简体   繁体   中英

Why cant I use Pattern.UNICODE_CHARACTER_CLASS in My Android App?

I have configured my android app to use java 8 as below

So why cant I use this Constant from java.util.regex.Pattern

eg Pattern.UNICODE_CHARACTER_CLASS

private static final Pattern PATTERN = Pattern.compile("[\\p{Punct}']", Pattern.UNICODE_CHARACTER_CLASS);

Here is my Gradle file.

apply plugin: 'com.android.application'

android {
    compileSdkVersion = "android-N"
    buildToolsVersion = "24.0.0 rc4"

    defaultConfig {
        applicationId "com.software.crucifix.my.app"
        minSdkVersion 23
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    jackOptions {
        enabled true
    }
}

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
}

This constant is not part of the Android SDK ( Android - Pattern ). It seems it will be added in API level N but has no influence on Android as stated in the description.

This flag has no effect on Android , unicode character classes are always used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM