问题
I am getting some exceptions in crashlytics. but not able find the file or cause of an exception. Also, I am getting different line number every time.
I don't have much information I am seeking for the details.
From crashlytics I get the device details like :
-- Samsung SM-G950F -- Android 8 -- View.java line 18877, View.java line 18891
-- Oppo R7plusf -- Android 5 -- View.java line 13790
--Asus ASUS_X00LD -- Android 8 -- View.java line 17753
View.java line 18891 android.view.View.onRestoreInstanceState
Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{com.lendlease.plus/com.lendlease.plus.activity.ReceiptDetailActivity}: java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class android.os.Bundle instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/ivReceipt. Make sure other views do not use the same id.
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2955)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3030)
android.app.ActivityThread.-wrap11 (Unknown Source)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1696)
android.os.Handler.dispatchMessage (Handler.java:105)
android.os.Looper.loop (Looper.java:164)
android.app.ActivityThread.main (ActivityThread.java:6938)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Please let me know if you face such an exception or you may know any cause for this.
Thank you!
回答1:
Have u read the Crash report
expecting View State but received class android.os.Bundle instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/ivReceipt. Make sure other views do not use the same id. android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2955)
The report saying that in your ReceiptDetailActivity
layout you have two different view containing same id ivReceipt
As per your below comment
Yes in that layout there is one included layout which contains same ivReceipt id
Solution don't use same ID Just change the id name it will work
来源:https://stackoverflow.com/questions/53862673/view-java-line-18891-android-view-view-onrestoreinstancestate-exception