JSONArray.getString(1);
其中 ["name",null] 是 json 数组,抛出 JSONArray[1] not a string
仅在启用 proguard 时异常(exception)。
我在我的 proguard 规则中遗漏了什么吗?
最佳答案
您是否尝试过这些方法:
/**
* Returns the value at {@code index} if it exists, coercing it if
* necessary. Returns the empty string if no such value exists.
*/
public String optString(int index)
或者
/**
* Returns the value at {@code index} if it exists, coercing it if
* necessary. Returns {@code fallback} if no such value exists.
*/
public String optString(int index, String fallback)
好像不返回
null
对于字符串
关于android - 仅在启用 proguard 时 JSONArray 不是字符串异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39593619/