简体   繁体   中英

Android: IllegalArgumentException: Two views have same id in the hierarchy

I know this error may occur if you use same id for two views. But, in my case, I changed the id of the view 3 times to different names. Searched the project for duplicate id, there is no view with this id. I still get this occur when I open the app. I've rebuild the project also.

Any suggestions?

java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.myapp.test/com.myapp.test.MainActivity}: java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class android.support.design.stateful.ExtendableSavedState instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/fab_main_rs. Make sure other views do not use the same id.

I believe that you are missing the + in front of your id definition.

ie. instead of android:id="id/fab_main_rs" you should have android:id="@+id/fab_main_rs"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM