相关疑难解决方法(0)

android数据绑定错误:任务执行失败':app:dataBindingProcessLayoutsDebug'

我的伙伴在我们的'项目中使用android databinding.in我的电脑有错误,但在他的mac不错误.我无法解决这个程序.请帮助!! 这是我的构建gradle:

dataBinding {
    enabled = true
}
Run Code Online (Sandbox Code Playgroud)

第一个构建androidstudio说

com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:       Invalid byte 2 of 2-byte UTF-8 sequence.
Run Code Online (Sandbox Code Playgroud)

然后我重新保存XML文件使用UTF-8.但是出现了一个新问题.就像这样:

:app:dataBindingProcessLayoutsDebug
line 1:0 mismatched input '?' expecting {COMMENT, SEA_WS, '<', PI}
Error:Execution failed for task ':app:dataBindingProcessLayoutsDebug'.
Run Code Online (Sandbox Code Playgroud)

java.lang.NullPointerException(无错误消息)

    <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:bind="http://schemas.android.com/apk/res-auto">
    <data>
        <import type="android.view.View"/>
        <import type="com.vomoho.vomoho.common.Utils"/>
        <variable name="postDetail" type="com.vomoho.vomoho.entity.PostDetail" />
    </data>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        android:orientation="vertical">

        <include
            android:id="@+id/top"
            layout="@layout/dt_item_postdetail_top"
            bind:postDetail="@{postDetail}"/>

        <ImageView
            android:id="@+id/img1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginTop="8dp"
            android:scaleType="centerCrop"
            android:visibility="@{Utils.getPostType(postDetail.picList) == 0 ? View.GONE : View.VISIBLE}"
            bind:imageUrl="@{postDetail.picList.size() > 0 ? postDetail.picList.get(0) …
Run Code Online (Sandbox Code Playgroud)

java data-binding android

7
推荐指数
2
解决办法
5402
查看次数

标签 统计

android ×1

data-binding ×1

java ×1