0

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:

Output

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.

James Z
  • 11,838
  • 10
  • 25
  • 41
System32
  • 11
  • 2
  • Share some code, share logcat please. It's not possible to provide solution by this question right now. – Jeel Vankhede Oct 02 '18 at 13:37
  • Thank you so much for intrest. Isn't that related to https://stackoverflow.com/questions/30581531/maximum-number-of-parameters-in-java-method-declaration – System32 Oct 02 '18 at 13:39
  • I don't think so that it's related to your issue. – Jeel Vankhede Oct 02 '18 at 13:41
  • You think so? This is the part from ActivityMainBinding.java https://pastebin.com/CRR2V6UD Is there a way to exclude some elements from being auto generated in that constructor? – System32 Oct 02 '18 at 13:42
  • You might be passing more params to somewhere it expects less. That's why i asked you about code & logcat. – Jeel Vankhede Oct 02 '18 at 13:44
  • I can paste code, but xml is kind of very long. Please see here, if I add one more imageButton or any other element, it throws that error: [link] https://ibb.co/eseROe – System32 Oct 02 '18 at 13:48
  • **DO NOT post images of code, data, error messages, etc.** - copy or type the text into the question. [ask] – Rob Jan 11 '21 at 11:12

1 Answers1

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.

Mohd Qasim
  • 175
  • 1
  • 9