'Unable to parse XML - Kotlin
Caused by:
org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A
failure occurred while executing com.android.build.gradle.internal.res.ParseLibraryResourcesTask$ParseResourcesRunnable
Other error codes
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
- What went wrong: Execution failed for task ':app:parseDebugLocalResources'.
A failure occurred while executing com.android.build.gradle.internal.res.ParseLibraryResourcesTask$ParseResourcesRunnable Failed to parse XML file '/home/shinto/Documents/PostMethodTrialChecking/HelpIntern/app/build/intermediates/packaged_res/debug/layout/fragment_signup.xml'
fragment_signup.xml
<data>
<variable
name="users"
type="com.shinto.helpintern.MainViewModel" />
</data>
android:visibilities="@{users.}"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/progBar"
android:layout_width="match_parent"
android:layout_height="match_parent">
Solution 1:[1]
Your XML code is wrong. And as the error suggests, compiler expects a <, means an opening tag. Why?
Because this line
android:visibilities="@{users.}" is misplaced and isn't in any tag. Even if it was in its correct position, it wouldn't work, because there's nothing called visibilities, it's visibility.
I assume you want to toggle the visibility of the ContraintLayout based on any (assuming boolean) value of the data. To do that, change your code as:
<data>
<import type="android.view.View"/>
<variable
name="users"
type="com.shinto.helpintern.MainViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/progBar"
android:visibility="@{users.yourValue? View.GONE : View.VISIBLE}"
android:layout_width="match_parent"
android:layout_height="match_parent">
This will toggle the layout's visibility based on the value of your model.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Lalit Fauzdar |

