私は自分のプロジェクトに複数のモジュールを持っています。モジュールアプリとモジュールAのライブラリとして機能するモジュールAを考えてみましょう。私は、データバインディングを使用し、各モジュールのbuild.gradleにAndroidデータバインディングには別のモジュールのレイアウトが含まれています
dataBinding { enabled = true }
を追加することにより、正常に動作します。
タグを使用してモジュールAからレイアウトを含めるときに問題が発生しました。私が含まれるレイアウトのデータバインディングにアクセスしようとしているとき、それは代わりにViewDataBinding
のViewオブジェクトを返す私が含まれるレイアウト内のIDへのアクセスを継続しようとしているときただし、コンパイルが正常に動作しますIDEでもエラーが表示されます。私は、プロジェクトを再構築しようとしました、キャッシュを無効にし、他のすべて。
そして、私はすでに、データバインディングを実装する方法をルールに従って確信しています。
<layout xmlns:android="http://schemas.android.com/apk/res/android>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_gray"
android:orientation="vertical">
<include layout="@layout/included_layout" id="@+id/contact"/>
</LinearLayout>
</layout>
とモジュールA上のレイアウト:
<layout xmlns:android="http://schemas.android.com/apk/res/android>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tv_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</layout>
エラーIDEには何が表示されますか? –
シンボルを解決できません。基本的にシンボルが見つかりません。https://i.stack.imgur.com/afIQX.png – luthfihariz