无法解析XML -Kotlin
Caused by:
org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A
failure occurred while executing com.android.build.gradle.internal.res.ParseLibraryResourcesTask$ParseResourcesRunnable
其他错误代码
FAILURE: Build completed with 2 failures.
1:任务失败,异常。
- 出了什么问题: 任务执行失败':APP:PARSEDEBUGLOCALRESOURCES'。
执行com.android.build.gradle.internal.res.res.parselebraryraryresourcestask $ parseresourcesrunnable时发生故障 无法解析XML文件'/home/shinto/documents/postmethodtrialchecking/helpintern/helpintern/app/build/build/build/intermediates/packaged_res_res/debug/debug/layout/layout/fragment_signup.xignup.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">
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">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的XML代码是错误的。正如错误所暗示的那样,编译器期望
&lt;
表示开放标签。为什么?因为这线
android:visibilities =“@{用户。}”
放错了位置,并且不在任何标签中。即使处于正确的位置,它也无法使用,因为没有什么叫做可见性
,它是可见性
。我假设您想根据数据的任何(假设布尔值)值切换
containtlayout
的可见性。为此,将您的代码更改为:这将根据模型的值切换布局的可见性。
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 calledvisibilities
, it'svisibility
.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:This will toggle the layout's visibility based on the value of your model.