Search code examples
javajava-8android-gradle-pluginandroid-studio-2.2android-jack-and-jill

How to resolve locale issue with `jack.import.type.policy`?


I am building an app which must use Java 8 libraries. To enable source compatibility I added following to app's build.gradle:

compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
    applicationId "SOME_APP"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    // enable Jack
    jackOptions {
        enabled true
    }
}
//...
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

Upon building solution I get following errors:

Error:com.android.sched.util.config.PropertyIdException: Property 'jack.import.type.policy' (in -D option): The value must be {keep-fırst,faıl} (case insensitive) but is 'keep-first'
Error:com.android.sched.util.codec.ParsingException: The value must be {keep-fırst,faıl} (case insensitive) but is 'keep-first'

As you can see this error is caused by Turkish İ i I ı chars. Someone else got this error and this is the issue ticket. This issue is marked for resolve in the future release but, due to importance of project I cannot wait for this future release.

There is a suggested solution in issue ticket:

A tricky solution that i made: Created run configurations for all jack related tasks in gradle (almost 9), and update VM Options part with -Duser.language=en

I tried to apply this by editing VM Options

enter image description here

and adding -Duser.language=en to studio.exe.vmoptions file.

Unfortunately this does not resolve the issue, I get same errors whenever I try to build project.

  • Is my current configuration right?
  • Is there another way to resolve this?

Solution

  • Found a working solution. This behaviour is caused by language of non-unicode programs settings in Windows. I had Turkish as language of non-unicode programs. After changing it to English issue resolved.

    [EDIT] The following solution is valid for Android Studio running on Windows

    To change, navigate to Control Panel -> Region and Language. Click on Administrative tab. Click on Change system locale and select English. Click apply and restart if necessary.

    enter image description here