解析JSON时出现以下错误-
“ org.json.JSONException:java.lang.String类型的值CLEARTEXT
无法转换为JSONObject **”。
该错误仅出现在Android Pie(9)上,并且该应用程序适用于较低版本。
我正在使用Retrofit2发出网络请求。
这是我的要求-
{"method_name":"uLogin","body":{"psw":"mypassword","emp_type":"1","emp_cont":"contact No"}}
最佳答案
I have got solution. it is below.
https://stackoverflow.com/questions/55323315/retrofit2-response-null-on-android-pie
android:usesCleartextTraffic="true"
tools:targetApi="p"
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:targetApi="p">
关于java - android pie 9.0 mobile:org.json.JSONException:类型为java.lang.String的值CLEARTEXT无法转换为JSONObject,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56904277/