数据绑定-ActivityMainBinding.java错误:参数过多 [英] Data binding - ActivityMainBinding.java error: too many parameters

查看:89
本文介绍了数据绑定-ActivityMainBinding.java错误:参数过多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我在Android上发现了DataBinding.效果很好,我遵循了一些指南,但是直到我的项目在视图中获得更多元素之前,它一直有效.一旦达到一定数量,我会得到:

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:

我可以注意到我添加到视图中的每个元素都会在ActivityMainBinding.java中获得生成的属性,好像我已经达到了一些限制?

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

整个xml被

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


</layout>

我已经在Google和此处进行了搜索,但似乎没有人遇到类似的问题.它与元素计数严格相关-我再添加一个元素就会引发错误.请给我一些建议或解决方法.

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.

推荐答案

如果您使用的是Android Gradle插件版本3.1.0-alpha06和更高版本,请在gradle.properties文件中添加以下选项:

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.

这篇关于数据绑定-ActivityMainBinding.java错误:参数过多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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