问题
I'm facing problem when I run the app on my mobile and when I run the error with stack trace or with debug option there is no error so I don't know what to do Here's the error message
Error:Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path` $
回答1:
This usually happens when your model is expecting a JSON array value but was surprised by a String value so it threw an exception. You can solve this in two different ways:
1- Edit your API response to return an empty JSON array or a JSON array with only one value in it. I mean always wrap your response value in a JSON array.
2- Edit your model to accept all data types, you can use Object as the data type for this value then cast it to an array or to a single value only.
Hope this helps, happy coding!
来源:https://stackoverflow.com/questions/47884928/how-to-solve-expected-begin-array-but-was-string-at-line-1-column-1-path