1、在虚拟机上我使用的是Android5.0版本,当前manifests的application标签配置如下,正确运行没问题。

android:allowBackup="true"

android:icon="@mipmap/ic_launcher"

android:label="qsj_weather_task_6"

android:roundIcon="@mipmap/ic_launcher_round"

android:supportsRtl="true"

android:theme="@style/AppTheme">

2、但是放到真机上(Android 9)就会闪退,于是在application标签里面添加一行代码:android:usesCleartextTraffic=“true”。就可以正确运行了。

android:allowBackup="true"

android:icon="@mipmap/ic_launcher"

android:label="qsj_weather_task_6"

android:roundIcon="@mipmap/ic_launcher_round"

android:supportsRtl="true"

android:usesCleartextTraffic="true"

android:theme="@style/AppTheme">

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐