Warning: warning: Supported source version 'RELEASE_7' from annotation processor 'android.arch.lifecycle.LifecycleProcessor' less than -source '1.8'

后端 未结 2 1623
無奈伤痛
無奈伤痛 2021-01-01 08:41

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, O

相关标签:
2条回答
  • 2021-01-01 09:19

    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.

    0 讨论(0)
  • 2021-01-01 09:24

    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"
    
    0 讨论(0)
提交回复
热议问题