在AndroidStudio 2.3.2中使用Java8不起作用

在AndroidStudio 2.3.2中使用Java8不起作用,java,android,Java,Android,我有一个为Java8构建的APi。 目前,我在Ubuntu上安装了Android Studio 2.3.2,老实说,我不太愿意更新它 我使用了Jack并将目标和源代码兼容性设置为Java版本1.8。 当我处于调试模式时,一切都按预期进行 但当我想创建一个签名的apk时,我会遇到如下错误: 我在这里试过这个 但是用“java--version”检查java版本会告诉我,我的机器上已经安装了Java1.8 我能做什么?我不想升级到Android 3+ 这是我的gradle(应用程序): 这是gra

我有一个为Java8构建的APi。 目前,我在Ubuntu上安装了Android Studio 2.3.2,老实说,我不太愿意更新它

我使用了Jack并将目标和源代码兼容性设置为Java版本1.8。 当我处于调试模式时,一切都按预期进行

但当我想创建一个签名的apk时,我会遇到如下错误:

我在这里试过这个

但是用“java--version”检查java版本会告诉我,我的机器上已经安装了Java1.8

我能做什么?我不想升级到Android 3+ 这是我的gradle(应用程序):

这是gradle(项目):


支持java-8是从android studio 3.0+开始的,我想你现在需要更新你的android studio了,检查一下@MoustafEL Saghier这个怎么办:你能检查不推荐的部分和android studio的集成吗?我更喜欢直接使用android studio而无需任何变通。你的确切意思是什么?你必须更新android studio并正式使用它支持java-8从android studio 3.0+开始,我认为你现在需要更新你的android studio检查这个@MoustafEL Saghier怎么办:你能检查不推荐的部分和集成吗去安卓工作室?我更喜欢直接使用android studio而不需要任何变通方法。你的确切意思是什么?你必须更新android studio并正式使用它
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
    applicationId "com.project.myapp"
    minSdkVersion 17
    targetSdkVersion 26
    versionCode 12
    versionName "1.055"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled = true
    jackOptions {
        enabled true
    }

}
buildTypes {
    debug {
        resValue "string", "google_maps_api_key", GoogleMapDebug
    }

    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        resValue "string", "google_maps_api_key", GoogleMapRelease


    }


    compileOptions{
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }




}

sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/asset/'] } }
 }

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.support:design:26.1.0'

compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.3.1'
compile 'com.android.support:support-v4:26.3.1'
compile 'com.google.android.gms:play-services-location:12.0.+'
compile 'com.google.android.gms:play-services-maps:12.0.+'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile 'com.patrickpissurno:ripple-effect:1.3.1'
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.google.firebase:firebase-messaging:12.0.1'
compile 'com.firebase:firebase-jobdispatcher:0.5.2'
compile 'com.firebaseui:firebase-ui-database:3.3.0'
compile 'com.google.firebase:firebase-auth:12.0.1'
compile 'com.firebaseui:firebase-ui:3.3.0'
compile 'com.firebaseui:firebase-ui-auth:3.3.0'
compile 'com.squareup.picasso:picasso:2.71828'
compile 'com.github.medyo:android-about-page:1.2.5'
compile 'de.codengine:tankerkoenig-api-client:1.0'


testCompile 'junit:junit:4.12'
 }
 apply plugin: 'com.google.gms.google-services'
  // 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.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven{
            url "https://maven.google.com"
        }
    }
}

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


def keystorePropertiesFile = rootProject.file("gradle.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))