Bootstrap

记录点android升级内容

  1. Cleartext HTTP traffic to yun.tjwzkj.com not permitted

在android中不仅要由网络权限<uses-permission android:name="android.permission.INTERNET"/>,而且需要在Application中增加android:usesCleartextTraffic="true"

 还可以创建xml文件夹里面有个network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>

<network-security-config>

    <base-config cleartextTrafficPermitted="true" />

</network-security-config>

在AndroidManifest.xml中

 <application

        android:allowBackup="true"

        android:icon="@mipmap/ic_wzkj"

        android:label="@string/app_name"

        android:roundIcon="@mipmap/ic_launcher_round"

        android:supportsRtl="true"

        android:theme="@style/AppTheme.NoActionBar"

        android:networkSecurityConfig="@xml/network_security_config"

        android:usesCleartextTraffic="true">

  1. android自动更新

2.1)遇到2个问题

'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference

这个需要在xml目录下建立一个filepaths.xml

<?xml version="1.0" encoding="utf-8"?>

<paths>

    <external-path

        name="files_root"

        path="Android/data/com.aaa.web/" />

    <external-path

        name="external_storage_root"

        path="." />

</paths>

2.2)需要在AndroidManifest.xml中加入

<provider

            android:name="android.support.v4.content.FileProvider"

            android:authorities="${applicationId}.fileprovider"

            android:exported="false"

            android:grantUriPermissions="true">

            <meta-data

                android:name="android.support.FILE_PROVIDER_PATHS"

                android:resource="@xml/filepaths"

                />

        </provider>

2.3)需要在AndroidManifest.xml加入一下权限

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"

        tools:ignore="ScopedStorage" />

    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />

    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

    <uses-permission

        android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"

        tools:ignore="ProtectedPermissions" />

;