Retrolambda - Jack is required to support java 8 - warning fix

后端 未结 4 1251
礼貌的吻别
礼貌的吻别 2021-02-12 09:58

Is there a way to disable warning about

Jack is required to support java 8 language features.

while using Retrolambda?

I don

相关标签:
4条回答
  • 2021-02-12 10:20

    You can just remove the following configuration from your build.gradle file:

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    

    The retrolambda plugin will take care of this anyway and setup the Java compiler task with the correct source and target compatibility settings.

    0 讨论(0)
  • 2021-02-12 10:27

    I confirm it is safe to remove VERSION_1_8 reference in build.gradle. Furthermore if one set jack support to true at the same time at setting JAVA Version to 1.8 and using Retrolambda, the following error kicks in:

    java.lang.NullPointerException (no error message)

    0 讨论(0)
  • 2021-02-12 10:29

    android studio

    Add below codes in your application gradle after that do synck

    // ----- add
    buildscript {
        repositories {
            mavenCentral()
        }
    
        dependencies {
            classpath 'me.tatarka:gradle-retrolambda:3.2.4'
        }
    }
    
    repositories {
        mavenCentral()
    }
    // ----- end
    
    apply plugin: 'com.android.application'
    apply plugin: 'me.tatarka.retrolambda' // ----- add 
    
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.2"
    
    //----add
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    
    0 讨论(0)
  • 2021-02-12 10:35
    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.3"
        defaultConfig {
            applicationId "io.github.rxandroid"
            minSdkVersion 15
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            jackOptions {
                enabled true
    
            }
    
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    
    }
    
    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:appcompat-v7:25.3.1'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
        testCompile 'junit:junit:4.12'
    
        compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
        compile 'io.reactivex:rxjava:1.3.0'
        compile 'com.jakewharton:butterknife:8.6.0'
        compile 'com.squareup.retrofit2:retrofit:2.3.0'
        compile 'com.squareup.retrofit2:converter-gson:2.2.0'
        compile 'com.squareup.retrofit2:adapter-rxjava:2.2.0'
    
    }
    
    0 讨论(0)
提交回复
热议问题