本文介绍了警告:杰克工具链已弃用Android Studio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的android studio更新到了3.0版,我在Studio的先前版本中使用的是jackOption.更新后会出现此警告.我得到了这个警告.但是我不知道建议在哪里添加这两行?

I updated my android studio to version 3.0, I was using jackOption in previous version of studio. After update this warning comes. I got this warning. But i don't know where to add these two lines suggested?

Warning:The Jack toolchain is deprecated and will not run. To enable support for Java 8 language features built into the plugin, remove 'jackOptions { ... }' from your build.gradle file, and add

    android.compileOptions.sourceCompatibility 1.8
    android.compileOptions.targetCompatibility 1.8

Future versions of the plugin will not support usage of 'jackOptions' in build.gradle.
To learn more, go to https://d.android.com/r/tools/java-8-support-message.html

推荐答案

步骤1:打开build.gradle(模块应用)

Steps 1: Open your build.gradle (module app)

第2步:在android块下方添加以下行,如

Steps 2: Add below lines under android block like

android {
    //.. other code
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

第3步:同步项目或单击sync now(显示在右上角)

Step 3 : synch project or click sync now(appear on right top corner)

注意:如果build.gradle(模块)中有jackOptions,则

Note : if you have jackOptions in build.gradle(module)

defaultConfig {
    jackOptions {
        enabled true
    }
}

然后删除jackOptions块

您也可以通过选择

File -> Project structure

选择app->Properties并选择Java 8作为兼容性

Select app->Properties and choose java 8 as compatibility as

这篇关于警告:杰克工具链已弃用Android Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 19:58