2016-07-06 35 views
17

有没有一种方法来禁用约Retrolambda - 杰克需要支持Java 8 - 警告修复

杰克需要支持Java 8个语言特性的警告。

while using Retrolambda?

我现在不需要插孔支持,因为它还没有编译我们的项目。

+0

它不是一个警告,它只是一个信息。那为什么还要把它关掉? – Lovis

+0

当事情干净时你难道不爱吗?其实它在詹金斯看起来很糟糕,因为它有30条线。 我知道这不是什么大不了的事情,但如果它快速解决,为什么不打扰呢? – miszmaniac

+0

30行?这很有趣,我只有“8”。无论如何。不,我真的不关心这些事情。 (如果这是一个真正的警告,会有所不同) – Lovis

回答

15

机器人工作室

添加以下代码在您的应用程序gradle这个是做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 
    } 
+5

这并没有回答这个问题 –

5

您可以直接从您的build.gradle文件中删除以下配置后:

compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_8 
    targetCompatibility JavaVersion.VERSION_1_8 
} 

retrolambda插件会照顾到这一点,并设置Java编译器任务具有正确的源和目标兼容性设置。

+2

nope,这将不会摆脱消息(如果你使用retrolambda这是必须添加这些行afaik) – Lovis

+0

嗯,你真的尝试过吗?查看retrolambda插件的源代码,可以看出它的确如我所描述的那样,并且我只是测试了如果兼容性设置未设置为VERSION_1_8,则Jack警告消失。 –

+0

我不是OP,但是我知道我的'build.gradle'中有这些行,我仍然可以获得信息 - 也许我需要更新retrolambda,然后。 – Lovis

-1
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

您不应该使用这个 'jackOptions {0}启用true } Jack项目已关闭,当Android Studio 3.0进入稳定通道时,您可以从项目中删除retrolambda,因为这已经在那里完美运行了! – miszmaniac