Comments (16)
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.
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.
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.
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.
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.
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
for all fragments which use data binding
from andfun-kotlin-android-trivia.
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.
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.
I can also confirm that "Invalidate Caches / Restart" fixes the problem.
from andfun-kotlin-android-trivia.
i have done and checked all this hints but still getting error
from andfun-kotlin-android-trivia.
i have done and checked all this hints but still getting error
@yavinash1413 did you solve the problem finally?
from andfun-kotlin-android-trivia.
did you got the solution to this very problem I'm getting the same issue
from andfun-kotlin-android-trivia.
I have this problem on a new fresh project. So based on the steps that we have to take
- I added an blank fragment_policy.xml
- It also created PolicyFragment.kt for me.
- 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.
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.
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.
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)
- GameWonFragment compiler error when implementing SafeArgs HOT 20
- Fails to build in Android Studio 3.4, citing Gradle errors or IDE fatal error HOT 2
- E/ViewRootImpl: sendUserActionEvent() mView == null HOT 3
- AndroidX implementation HOT 4
- Navigation drawer not closing HOT 5
- Can't use safe args HOT 2
- Can't add "layout_gravity" property to NavigationView in DrawerLayout HOT 5
- Can't build the project as license for sdk is not accepted
- Gradle sync failure. Could not find androidx.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha07. HOT 2
- GameWonFragment compiler error when passing fragment in ShareCompat.IntentBuilder.from() HOT 6
- Step.09-Solution not working HOT 2
- Redundant code in GameFragment.kt (Branch: Step.03-Exercise-Conditional-Navigation)
- Gradle sync failure. Failure to resolve - android.arch.navigation:navigation-fragment-ktx:2.3.0, - android.arch.navigation:navigation-ui-ktx:2.3.0 HOT 3
- Unsolved referense
- deprecated way for options Menu HOT 1
- The app doesn't complie once used because the old navigation Libaries and need to update target SDK HOT 7
- Adding the Up-Button causes app crashing
- Incompatible Kotlin/Gradle Version on Branch Step.01-Exercise-Creating-and-Adding-a-Fragment HOT 4
- Method onSupportNavigateUp: Sequence of method arguments interchanged HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from andfun-kotlin-android-trivia.