RocketX icon indicating copy to clipboard operation
RocketX copied to clipboard

No static field xxx of type I in class Lcom/xxx/xxx/BR;

Open Wensibob opened this issue 2 years ago • 1 comments

crash log:

 No static field mineEntity3 of type I in class Lcom/xxx/xxx/BR; or its superclasses (declaration of 'com.xxx.xxx.BR' appears in /data/app/com.xxx.xxx-gaZwgXnV8Bo9TEjryZesXw==/base.apk!classes25.dex)

description: a.xml includes b.xml which is in the same module, when I disable the RocketX , the app does not crash ,but when I enable it,the app crash. I find the build folder in the module, the BR.java is generated, and the field xxx exists, but the field does not exist in BR.java in APK, more information as below:

  • a.xml
<?xml version="1.0" encoding="utf-8"?>

<layout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools">

   <data>

       <import type="android.view.View" />

       <variable
           name="viewModel"
           type="com.xxx.xxx.viewmodel.MineViewModelV2" />
   </data>



   <include
       layout="@layout/b"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_marginStart="26dp"
       android:layout_marginEnd="26dp"
       app:mineEntity3="@{viewModel.mineMainEntity.data}" />

</layout>
  • b.xml
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools">


   <data>

       <variable
           name="mineEntity3"
           type="com.zhenai.mine.mine.entity.MineEntityV2" />
   </data>

   <merge
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">

       <com.xxx.xxx.widget.MineFragmentInteractionItemLayout
           android:id="@+id/xxx"
           android:layout_width="0dp"
           android:layout_height="wrap_content"
           android:layout_marginStart="@dimen/dp15"
           android:layout_marginTop="@dimen/dp15"
           app:valueStr="@{mineEntity3.dataIndexList.get(0).topicDesc}"/>
   </merge>
</layout>

Wensibob avatar Jul 06 '22 03:07 Wensibob

@Wensibob
hi, you can try to clean before build . by the way , please check aar of current module has BR.java ?

trycatchx avatar Jul 12 '22 03:07 trycatchx