Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set byteCode level when creating a android library module in android studio 4.1.1?

This image shows the pop up dialog when we create a new module from the list of module types. Here i have selected Android Library. This image shows the pop up dialog when we create a new module from the list of module types.

like image 207
Vatsal kesarwani Avatar asked Nov 20 '20 14:11

Vatsal kesarwani


1 Answers

I think that this setting represents the compileOptions and kotlinOptions.

https://developer.android.com/studio/write/java8-support

For example, if you set ByteCode Level to 6, the compileOptions and kotlinOptions in the build.gradle of the module you created will look like this.

android {
    .
    .
    .
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    }
    kotlinOptions {
        jvmTarget = '1.6'
    }
}

Also, if ByteCode Level is set to 8, the following will be shown.

android {
    .
    .
    .
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}
like image 189
Horie1024 Avatar answered Sep 25 '22 11:09

Horie1024