Reputation: 3974
Trying to build a sample using Android Studio 3 Canary 5 with Architecture Components and Kotlin gives this warning.
Can anyone tell me the reason?
Thanks, Ove
Edit #1: This is a sample made some time ago by Dan Lew
https://github.com/dlew/android-architecture-counter-sample
build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 25
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "net.danlew.counter"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:${rootProject.ext.supportLibVersion}"
compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
compile "com.android.support:cardview-v7:${rootProject.ext.supportLibVersion}"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile "android.arch.lifecycle:extensions:${rootProject.archLifecycleVersion}"
compile "android.arch.persistence.room:runtime:${rootProject.archRoomVersion}"
compile "android.arch.persistence.room:rxjava2:${rootProject.archRoomVersion}"
kapt "android.arch.lifecycle:compiler:${rootProject.archLifecycleVersion}"
kapt "android.arch.persistence.room:compiler:${rootProject.archRoomVersion}"
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
String butterKnifeVersion = '8.5.1'
compile "com.jakewharton:butterknife:$butterKnifeVersion"
kapt "com.jakewharton:butterknife-compiler:$butterKnifeVersion"
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
String daggerVersion = '2.10'
compile "com.google.dagger:dagger:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
String rxBindingVersion = '2.0.0'
compile "com.jakewharton.rxbinding2:rxbinding:$rxBindingVersion"
compile "com.jakewharton.rxbinding2:rxbinding-kotlin:$rxBindingVersion"
compile 'com.jakewharton.timber:timber:4.5.1'
compile 'com.jakewharton.rxrelay2:rxrelay:2.0.0'
}
repositories {
mavenCentral()
}
Upvotes: 42
Views: 25008
Reputation: 3484
There is a Java 8 annotation processor now arch components are stable so replace:
"android.arch.lifecycle:compiler:${rootProject.archLifecycleVersion}"
with
"android.arch.lifecycle:common-java8:1.0.0"
Upvotes: 29
Reputation: 45503
Just adding this answer for future reference: the same issue was also raised with the Android Arch Components team a while ago and the official answer for now is:
(...) it is just a warning. Should not be a problem.
This applies to warnings following the format mentioned in the title of the question, and include:
w: warning: Supported source version 'RELEASE_7' from annotation processor 'android.arch.lifecycle.LifecycleProcessor' less than -source '1.8' w:
w: warning: Supported source version 'RELEASE_7' from annotation processor 'android.arch.persistence.room.RoomProcessor' less than -source '1.8' w:
Basically it's javac
informing you that these annotation processors were compiled against and generate code for a different (older) version of Java (Java 7) than your module's source level is set to (Java 8). The reason for this is that the compiler cannot make any promises that the processors will then still behave correctly [but the developers can and did in this particular case].
Note that the warning is still issued if you remove the -Xlint
compiler flag, so short of using -nowarn
it cannot be suppressed unfortunately.
Upvotes: 19