Android Databinding: “Method references using '.' is deprecated”

前端 未结 4 2189
悲哀的现实
悲哀的现实 2021-02-19 07:34

When using databinding in my app, I get the following warning when compiling:

Warning:Method references using \'.\' is deprecated. Instead of \'handler.onItemClick

4条回答
  •  执念已碎
    2021-02-19 08:10

    My guess is that the deprecation warning is shown because Android Data Binding is currently not being fully compatible with Java 8. Putting the following into your project's build.gradle file should hide mentioned warning.

    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }
    

    Unless you are using Java 8 features in your project.

提交回复
热议问题