房间建造警告 [英] Room build warning

查看:78
本文介绍了房间建造警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目(版本1.0.0)中有Android Room Persistence库,并将编译选项设置为1.8.当项目构建完成时,我会收到以下警告:

I have Android Room Persistence library in project(version 1.0.0) and set compile options to 1.8. When project build finishes, i get this warning:

警告:注释处理器"android.arch.persistence.room.RoomProcessor"支持的源版本"RELEASE_7"小于-source"1.8"

Warning:Supported source version 'RELEASE_7' from annotation processor 'android.arch.persistence.room.RoomProcessor' less than -source '1.8'

一切正常,但是这个警告使我烦恼.如何删除它?

Everything works fine, but this warning annoys me. How to remove it?

添加此依赖项不会删除警告,并且我不使用其他体系结构组件.

Adding this dependency dosn't remove warning and i don't use another architecture components.

"android.arch.lifecycle:common-java8:1.0.0"

推荐答案

(注意:此答案与使用'kotlin-kapt'插件(kotlin注释处理器插件)的基于Kotlin的gradle项目有关,但也应该有用到基于Java的项目.)

(Note: this answer is relevant to Kotlin based gradle projects that use the 'kotlin-kapt' plugin (kotlin annotation processor plugin), but should also be useful to Java based projects.)

此警告似乎已在最新版本的Room库中修复.

This warning seems to be fixed in the latest version of the Room library.

我替换了:

kapt "android.arch.persistence.room:compiler:1.0.0"

kapt "android.arch.persistence.room:compiler:1.1.0-alpha1"

警告消失了.

顺便说一句,对于Kotlin项目,警告消息随Kotlin版本的不同而不同.

BTW, for Kotlin projects, the warning message varies with the Kotlin version.

使用Kotlin 1.1.0,它是:

With Kotlin 1.1.0 it's:

警告:注释处理器'android.arch.persistence.room.RoomProcessor'支持的源版本'RELEASE_7'小于-source'1.8'

warning: Supported source version 'RELEASE_7' from annotation processor 'android.arch.persistence.room.RoomProcessor' less than -source '1.8'

但是对于Kotlin 1.2.21,它是:

but with Kotlin 1.2.21 it's:

警告:注释处理器'org.jetbrains.kotlin.kapt3.ProcessorWrapper'支持的源版本'RELEASE_7'小于-source'1.8'

warning: Supported source version 'RELEASE_7' from annotation processor 'org.jetbrains.kotlin.kapt3.ProcessorWrapper' less than -source '1.8'

在两种情况下,修复方法都是相同的.

The fix was the same in both cases.

这篇关于房间建造警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆