Data binding - ActivityMainBinding.java error: too many parameters

主宰稳场 提交于 2021-01-25 06:55:37

问题


recently I have discovered DataBinding on Android. It was working great, I have followed some guides, but it works until my project gets more elements inside the view. Once a certain amount is reached I get:

I can notice that every element I add to the view gets generated property in ActivityMainBinding.java seems like I have reached some limit?

The whole xml is surrounded by

    <layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">


</layout>

I have searched through google and here, but no one seems to have similar problem. It is strictly related to the element count - I add one more and it throws an error. Please give me some advice or workaround.


回答1:


if your using Android Gradle plugin version 3.1.0-alpha06 and higher version add the following option to your gradle.properties file:

android.databinding.enableV2=false

Previous versions of the data binding compiler generated the binding classes in the same step that compiles your managed code. If your managed code fails to compile, you might get multiple errors reporting that the binding classes aren't found. The new data binding compiler prevents these errors by generating the binding classes before the managed compiler builds your app.



来源:https://stackoverflow.com/questions/52609442/data-binding-activitymainbinding-java-error-too-many-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!