<application
android:allowBackup="true"
android:networkSecurityConfig="@xml/network_security_config"
android:name=".base.BaseApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
这个也添加了
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">api.ximalaya.com</domain>
</domain-config>
</network-security-config>
这个也配置了但是还是报错误
2020-05-13 18:33:36.803 29627-29627/? W/Looper: Slow Looper: Activity com.example.eryu/.MainActivity is 357ms late (wall=369ms running=0ms ClientTransaction{ callbacks=[android.app.servertransaction.LaunchActivityItem] lifecycleRequest=android.app.servertransaction.ResumeActivityItem }) because of 1 msg, msg 1 took 419ms (h=android.app.ActivityThread$H w=110)
2020-05-13 18:33:36.837 29627-29627/? W/Looper: Slow Looper: Activity com.example.eryu/.MainActivity is 757ms late (wall=3ms running=0ms ClientTransaction{ lifecycleRequest=android.app.servertransaction.PauseActivityItem }) because of 3 msg, msg 1 took 419ms (h=android.app.ActivityThread$H w=110), msg 2 took 369ms (late=357ms h=android.app.ActivityThread$H w=159)
2020-05-13 18:33:36.843 29627-29627/? W/Looper: Slow Looper: Activity com.example.eryu/.MainActivity is 342ms late (wall=5ms running=0ms ClientTransaction{ lifecycleRequest=android.app.servertransaction.StopActivityItem }) because of 5 msg, msg 1 took 369ms (late=357ms h=android.app.ActivityThread$H w=159)
2020-05-13 18:33:36.844 29627-29627/? E/MainActivity: error code -- 604error msg ==> 网络请求失败
试试在<application里加上
添加这个
https://www.sunofbeach.net/qa/1202116556126015488
https://www.sunofbeach.net/qa/1232496914574913536
参考参考,大家都遇到这样子的。
你抓一份Log补充一下吧。