android1.apk,Android 7.1.1 安装Apk问题。

我在测试Android 7.0 安装APK 问题时,为何使用了新的安装方式还是不能安装提示 解析软甲包时出现问题

非常简单的代码:

一、 这是安装的逻辑。因为我是直接跑在Android模拟器上面的。所以没有做版本号的判断。

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);

}

二、 这是 Provider 的配置。

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

android:authorities="com.example.along.installtest.fileprovider"

android:exported="false"

android:grantUriPermissions="true">

android:name="android.support.FILE_PROVIDER_PATHS"

android:resource="@xml/file_path">

三、这是权限的配置:

四、这是xml文件中的共享目录配置:

name="apkFile"

path="apkFile" />

然后我将此项目的VersionCode调高之后,打包之后,放在对应的apkFile文件中,然后调低VersionCode打包,然后运行显示解析包错误。这个问题调了好久了。 请大神帮忙。。。。。。一下。 贼鸡儿烦。

你可能感兴趣的:(android1.apk)