昨天我的手机更新为Android 9,到那时我的应用崩溃了。我从android studio重新安装了它,但问题仍然存在。上面有Manifest
代码,看是否有问题。
谢谢
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.johny.test">
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name = "android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
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"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
</application>
</manifest>
答案 0 :(得分:1)
在您的<application>
标签内的AndroidManifest.xml中使用此行
<application>
....
.... android:usesCleartextTraffic="true"
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
</application>
答案 1 :(得分:0)
我遇到了同样的问题,我解决了在manifest.xml中添加以下行:
<application
android:name=.....
android:networkSecurityConfig="@xml/network_security_config"
...
</application>
还要在res / xml文件夹上创建network_security_config.xml文件,然后使用以下代码填充它:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">DOMAIN WITHOUT HTTP://</domain>
</domain-config>
</network-security-config>
答案 2 :(得分:0)
将此行放在清单文件的application标记内
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />