添加Java8支持时Android Studio错误 [英] Android studio error when add java8 support

查看:197
本文介绍了添加Java8支持时Android Studio错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Android Studio或配置有什么问题?

what's wrong with my Android Studio or my config?

Error:(22, 0) Could not find method jackOptions() for arguments [build_1b0umrzpkhcolzr325bxbizec$_run_closure1$_closure5@41c39fc1] on project ':app' of type org.gradle.api.Project.

这是我的build.gradle

and this is my build.gradle

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
    applicationId "com.twtstudio.wepeiyanglite"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
jackOptions {
    enabled true
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}


// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0-beta1'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我猜我的开发环境中未启用插孔,如何找出错误并解决? 我已经安装了jdk1.8

I guess the jack is not enabled in my develop enviroment , and how to find out the mistakes and fix it? I have already installed the jdk1.8

推荐答案

jackOptions应该在defaultConfig {}内部,如下所示:

jackOptions should be inside defaultConfig{} like this:

defaultConfig {
    ...

    jackOptions {
        enabled true
    }
}

这篇关于添加Java8支持时Android Studio错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆