current position:Home>When the Android 10 app version is downgraded, you are prompted that the application is not installed. How to solve it?

When the Android 10 app version is downgraded, you are prompted that the application is not installed. How to solve it?

2022-02-04 16:50:55 CSDN Q & A

Now, app1.0 2.0 Two versions , The code difference is just versionCode and versionName atypism ; apk All packages are release edition

First step : Mobile phone installed 1.0 edition ; Then the background is updated to 2.0 edition , Mobile phone open app Will automatically download 2.0 Package update , Installation successful .
The second step : Backstage will app Version changed to 1.0; open app( Now? app The version is 2.0) Will automatically download 1.0 Package update But when installing, you will be prompted No app installed

//  install apk Part of the code private void installApk() {    File apkfile = mUpdateInfo.apkFile();    if (!apkfile.exists()) {        stopSelf();        return;    }    Intent intent = new Intent(Intent.ACTION_VIEW);    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);    if (Build.VERSION.SDK_INT >= 24) {        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);        Uri contentUri = FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".fileProvider", apkfile);        intent.setDataAndType(contentUri, "application/");    } else {        intent.setDataAndType(Uri.fromFile(apkfile), "application/");    }    startActivity(intent);    // Pop up the installation window and close the original program .    // Avoid no response when clicking open after installation  android 10  Can not close    // android.os.Process.killProcess(android.os.Process.myPid()) ;    stopSelf();}
<?xml version="1.0" encoding="utf-8"?><paths>    <!-- .  Represents the full path -->    <external-path path="." name="external_storage_root" /></paths>

How to solve this problem

Take the answer :

The updated version is lower than the installed version , Some phones will prompt to uninstall the higher version and reinstall , Some phones simply refuse to install

Other answers 2:

Only upgrade, not downgrade , If you want to update restore , Take the content of the old version code , Then change the version to the next version

Other answers 3:

The normal installation method cannot downgrade the installation , If you want to downgrade the installation, either uninstall the original app, reinstall , Or use the command to force the installation

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.

Random recommended