2016-07-06 30 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