Jack requires Build Tools 24.0.0 or later

来源:互联网 发布:php 过滤非utf8字符 编辑:程序博客网 时间:2024/05/16 19:40
com.Android.build.api.transform.TransformException: com.android.jack.api.ConfigNotSupportedException: Jack requires Build Tools 24.0.0 or later

        一般,此错误是由android7.0才开始支持jdk1.8引起的。 

        Android 7.0API 24)才开始支持JDK1.8,并且对应的AS的编译版本必须是24,即compileSdkVersion 24,编译版本低于24则会提示:

Error:Execution failed for task ':library:compileDebugJavaWithJavac'.> compileSdkVersion 'android-24' requires JDK 1.8 or later to compile.

        经亲自实测,compileSdkVersion 24 必须用JKD 1.8或以上,反之亦然,如果手动开启使用JDK1.8,则会强制要求compileSdkVersion24

 

使用JDK1.8 需要手动开启:

built.gradle

apply plugin: 'com.android.application'android {    compileSdkVersion 23    buildToolsVersion "23.0.3"    defaultConfig {        applicationId "com.ljheee.studyclock"        minSdkVersion 17        targetSdkVersion 23        versionCode 1        versionName "1.0"        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"        // Java8需要jack工具链支持        jackOptions{            enabled true        }    }    // 指定编译版本    compileOptions{        targetCompatibility = '1.8'        sourceCompatibility = '1.8'    }    buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }    }}dependencies {    compile fileTree(include: ['*.jar'], dir: 'libs')    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {        exclude group: 'com.android.support', module: 'support-annotations'    })    compile 'com.android.support:appcompat-v7:23.4.0'    compile 'com.android.support:support-v4:23.4.0'    compile 'com.android.support:design:23.4.0'    testCompile 'junit:junit:4.12'    compile 'com.loopj.android:android-async-http:1.4.9'}


阅读全文
1 0