Git Product home page Git Product logo

Comments (16)

jheske avatar jheske commented on August 22, 2024 4

The errors seem to indicate that Android couldn't bind the layout files because there's some kind of binding error. Debugging data binding errors is notoriously tricky because Android doesn't provide much feedback. Sometimes you just have to search the build output for "error" and there is usually a line describing the binding error.

In case there's a version conflict somewhere, try copying the library dependencies from our completed code on the master branch. That version works without the additional library.

If all else fails, compare your code to our solution.

from andfun-kotlin-android-trivia.

jheske avatar jheske commented on August 22, 2024 4

Hi Mishkuza, The master branch of that project does work as far as I know. I no longer work for Udacity, but master was last updated and working 6 months ago. Try selecting "Invalidate Caches / Restart" from the File menu (not sure where it is on Win).

from andfun-kotlin-android-trivia.

v-octal avatar v-octal commented on August 22, 2024 2

I also encountered this problem while going through this the second lesson(Layouts)!
I fixed it by rebuilding the project after changing to root element to in the activity_main.xml file.

Here's the StackOverflow thread from where I got the hint!

from andfun-kotlin-android-trivia.

im-ashraf avatar im-ashraf commented on August 22, 2024 1

The name is derived from the name of the layout file, that is, activity_main + Binding. Make sure it follows the same pattern

from andfun-kotlin-android-trivia.

GrapeJuice787 avatar GrapeJuice787 commented on August 22, 2024

Yeah this is not working for myself either. Very unfortunate, I am going to follow through the videos and not troubleshoot it any further I've wasted hours already.

from andfun-kotlin-android-trivia.

mishkuza avatar mishkuza commented on August 22, 2024

The errors seem to indicate that Android couldn't bind the layout files because there's some kind of binding error. Debugging data binding errors is notoriously tricky because Android doesn't provide much feedback. Sometimes you just have to search the build output for "error" and there is usually a line describing the binding error.

In case there's a version conflict somewhere, try copying the library dependencies from our completed code on the master branch. That version works without the additional library.

If all else fails, compare your code to our solution.

Hello @jheske ,

This issue is still present. I've cloned the project and it occurs on master branch, the latest commit
s1
s2

for all fragments which use data binding

from andfun-kotlin-android-trivia.

mishkuza avatar mishkuza commented on August 22, 2024

Hi Mishkuza, The master branch of that project does work as far as I know. I no longer work for Udacity, but master was last updated and working 6 months ago. Try selecting "Invalidate Caches / Restart" from the File menu (not sure where it is on Win).

@jheske thank you so much! I often forget to try it first and instead go to stackoverflow and dig in there trying loophole solutions ... Cheers to you, even though it's not in your duties anymore to follow here, thank you!

from andfun-kotlin-android-trivia.

mochadwi avatar mochadwi commented on August 22, 2024

Hi Mishkuza, The master branch of that project does work as far as I know. I no longer work for Udacity, but master was last updated and working 6 months ago. Try selecting "Invalidate Caches / Restart" from the File menu (not sure where it is on Win).

The basic and fundamental things to do tends to be forgotten. After Invalidate the caches & restart, the Data Binding works like expected once more.

from andfun-kotlin-android-trivia.

GalenWong avatar GalenWong commented on August 22, 2024

I can also confirm that "Invalidate Caches / Restart" fixes the problem.

from andfun-kotlin-android-trivia.

yavinash1413 avatar yavinash1413 commented on August 22, 2024

i have done and checked all this hints but still getting error

from andfun-kotlin-android-trivia.

sajib21 avatar sajib21 commented on August 22, 2024

i have done and checked all this hints but still getting error

@yavinash1413 did you solve the problem finally?

from andfun-kotlin-android-trivia.

IrshadKasana avatar IrshadKasana commented on August 22, 2024

did you got the solution to this very problem I'm getting the same issue

from andfun-kotlin-android-trivia.

houmie avatar houmie commented on August 22, 2024

I have this problem on a new fresh project. So based on the steps that we have to take

  1. I added an blank fragment_policy.xml
  2. It also created PolicyFragment.kt for me.
  3. Inside override fun onCreateView() of PolicyFragment.kt I can't instantiate the binding. It's not found. (Despite building and invalidating the project)

Under the generated java files under java/com.company.app/databinding I can only see ActivityMainBindingImpl

There is nothing about fragment. Have I missed anything? Thank you so much for your help

from andfun-kotlin-android-trivia.

houmie avatar houmie commented on August 22, 2024

I found the reason. Despite adding fragment through Android Studio it doesn't add tag to the fragment view, making it worthless. Until you do it by hand.

from andfun-kotlin-android-trivia.

Doenut999 avatar Doenut999 commented on August 22, 2024

Hi guys, I may have found the resolution to this problem.
You should nest your TitleFragment layout inside a layout tag, fix up the namespace declarations and create your data tags inside the Fragment Layout. That will fix the type mismatch from ViewBindingUtil to whatever you are using +util. Attaching pictures because my English is horrible. Love from Ghana

https://drive.google.com/file/d/14D1VCtkOumKPDk7pR8mh5cJ06Pe_SLZO/view?usp=sharing
https://drive.google.com/file/d/1r-VO5FpShAx65xwhe0VEF7ZhNe96MCtX/view?usp=sharing

from andfun-kotlin-android-trivia.

SudKul avatar SudKul commented on August 22, 2024

We'd appreciate it if a learner would submit a PR for this issue.
Besides, we could not replicate the issue.

from andfun-kotlin-android-trivia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.