Android 7.1.1 there is a problem installing Apk.

Why did I use the new installation method or not install when parsing the soft armour package

when I was testing the APK installation problem of Android 7.0s?

very simple code:

1. This is the logic of the installation. Because I ran directly on the Android simulator. So I didn"t make the judgment of the version number.

File apkFile = new File(Environment.getExternalStorageDirectory() + File.separator + "apkFile", "aaa.apk");
if (apkFile.exists()) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    Uri apkFileUri = FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".fileprovider", apkFile);
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    intent.setDataAndType(apkFileUri, "application/vnd.android.package-archive");
    startActivity(intent);
}

II. This is the configuration of Provider .

<provider
    android:name="android.support.v4.content.FileProvider"
    android:authorities="com.example.along.installtest.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/file_path">

    </meta-data>
</provider>

III, this is the configuration of permissions:

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

4. This is the shared directory configuration in the xml file:

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path
        name="apkFile"
        path="apkFile" />
</paths>

then I raise the VersionCode of this project, package it, put it in the corresponding apkFile file, then lower the VersionCode package, and then run to show the parsing package error. This question has been adjusted for a long time. Ask the god for help. Give me a minute. Thieves are annoying.

Mar.10,2021

you change the configuration in file_path.xml to:
< paths xmlns:android= " http://schemas.android.com/ap.;>

<external-path
    name="external_storage_root"
    path="." />

< / paths >
try it. Mine can be changed to this. Other codes are the same as yours

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3722a-2b3d2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3722a-2b3d2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?