android studio ButterKnife Zelezny 使用报错

一、 错误信息描述

使用插件生成的时候,一直报错,无法弹出如下的页面

具体的报错信息如下:


2、问题排查

经过快一个小时的排查, 首先怀疑插件冲突, 卸载掉前几天装的插件, 无效, 然后又升级、卸载重装IDE都不行。

后面突然发现在其他页面是可以正常使用的,所以怀疑是xml文件的问题。 故仔细排查了一遍xml文件,特别是id。果然发现异常的地方

有一个textview的 id 使用了两个下划线 __ ,在删除掉一个之后,插件就能正常使用了。

<TextView
            android:id="@+id/tv_get_cash_act__nurse_commission"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="@dimen/common_margin_12"
            android:text="提现  >"
            android:textColor="@color/white"
            android:textSize="16sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

3、 解决方法和思考

解决方法: 删除掉多余的下划线,只保留一个

思考: 使用插件的过程中,总是会遇到各种问题,尽量以最小损失的方式 一步一步排查, 卸载重装IDE实在是太浪费时间了。

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章