android - 在 android studio 4.1.1 中创建 android 库模块时如何设置 byteCode 级别?

标签 android module android-gradle-plugin bytecode

当我们从模块类型列表中创建一个新模块时,此图像显示了弹出对话框。在这里,我选择了 Android 库。
This image shows the pop up dialog when we create a new module from the list of module types.

最佳答案

我认为这个设置代表 compileOptionskotlinOptions .
https://developer.android.com/studio/write/java8-support
例如,如果您将 ByteCode Level 设置为 6,则 compileOptionskotlinOptionsbuild.gradle您创建的模块将如下所示。

android {
    .
    .
    .
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    }
    kotlinOptions {
        jvmTarget = '1.6'
    }
}
此外,如果 ByteCode Level 设置为 8,将显示以下内容。
android {
    .
    .
    .
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

关于android - 在 android studio 4.1.1 中创建 android 库模块时如何设置 byteCode 级别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64931493/

相关文章:

java - 如何删除android中的蓝色操作栏?

linux - 如何在 linux 上安装 lua 模块

android - 生命周期 Android 插件 gradle

android - 重复条目 Google Gson

android - Corona SDK - 如何实现对象取消触摸

android - 如果键只返回 true,如何通过连接从 Firebase 数据库中检索数据?

android - 如何在应用程序中使用 API Level 17 方法并编译 Ginger Bread 的代码?

python - 自动将当前目录下的所有模块导入python交互式解释器

javascript - 自动导入具有相同文件后缀的模块

android studio 3.1.4 离线模式