ViewBinding 与 Java11,AndroidStudio 总是显示错误(但运行没有任何问题) [英] ViewBinding with Java11, AndroidStudio always shows error (but runs without any problem)

查看:120
本文介绍了ViewBinding 与 Java11,AndroidStudio 总是显示错误(但运行没有任何问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,使用 Java8,AndroidStudio (Arctic Fox) 中的 viewBinding 没有问题.

I notice that with Java8 there is no problem with viewBinding in AndroidStudio (Arctic Fox).

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
    viewBinding true
}

但是,一旦我将 compileOptions 设置为 JavaVersion.VERSION_11,AndroidStudio 总是错误地显示 viewBiding(s) 错误,尽管它可以毫无问题地编译和运行.

However, once I set compileOptions to JavaVersion.VERSION_11, AndroidStudio always falsely shows viewBiding(s) errors though it can compile and run with no problem.

我在 AndroidStudio ArcticFox 中使用一个全新的项目对此进行了测试.它建议导入类.导入后显示Package not found:

I tested this with a fresh new project in AndroidStudio ArcticFox. It suggests to import the class. After imported, it says Package not found:

这是 AndroidStudio 的错误,还是我的 AndroidStudio 中的 Java 编译器设置有任何错误配置?

Is this AndroidStudio's bug, or are there any misconfiguration about Java compiler setting in my AndroidStudio?

我所做的只是JavaVersion.VERSION_11.

推荐答案

正如 google 的支持所回答的那样:此问题已修复并已登陆 BB canary 8.它特定于 Java 11.

As google's support answered: This issue has been fixed and landed in BB canary 8. It is specific to Java 11.

这篇关于ViewBinding 与 Java11,AndroidStudio 总是显示错误(但运行没有任何问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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