trycatchx / RocketX

🔥🔥 android 端编译加速插件🚀 动态识别未改动 module 并在编译流程中替换为 aar ,只编译改动模块,加速 Android apk 的编译速度。
861 stars 104 forks source link

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

Closed Wensibob closed 2 years ago

Wensibob commented 2 years ago

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:

<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}" />


 * b.xml
 ```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>
trycatchx commented 2 years ago

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