[Android] Solution to failed installation of built-in applications in Android mobile phone system

The existing idle mobile phone has a built-in app, but it is old and has no developers to maintain it. As a result, problems continue to affect the experience. Later, I searched online and found that there is a new version of it. I wanted to update it but it did not update automatically (the background service was disconnected). ), if you have similar ideas, you can come here to learn more.

As an Android APP developer, I often use adb debugging, which may not be familiar to novices. I will record the steps here. I hope it helps.

Developer options activated

First, check if there is a developer option in the system settings of the phone. If not, activate it and it will appear.

Find the phone system information in the settings, check it, find the MIUI version item, click it three times in a row, you will be prompted that the developer options are turned on.

Go back to the settings, look for the developer options just now, click in, turn on the main switch, and check ADB debugging

You also need to check the option to install applications through ADB.

Connect the data cable that comes with the phone through the computer. The authorization window will pop up on the phone. Just click Allow.

If the connection is successful, a notification will pop up on the phone indicating that ADB debugging is turned on, and devices available for viewing the phone will also appear in the computer explorer.

View device connections

Open the existing adb.exe folder on your computer, right-click here and open the CMD Shell terminal.

To find connectable mobile devices, enter the command:

./adb devices

Output a device information, the content format is as follows

devise serial number Connection Status
234*34 device

Monitor activity application

Before installing the application, if you don’t know the application package name, you can do this:

Open the installed app on your phone, and then operate it on your computer.

To monitor active application packages, enter the command

./adb shell am monitor

Then, go back to the phone to operate that application, open or switch pages,

At this time, the computer will monitor and output the application package information, the content is like this

Monitoring activity manager...  available commands:
(q)uit: finish monitoring
** Activity starting: com.android.***

Which com.android.***is the name of the application package operated on the mobile phone

Uninstall app

To uninstall an app package com.android.***, enter the command:

./adb uninstall com.android.***

Wait, don't uninstall,

Before uninstalling the application, you need to make a backup.

It's better to be cautious. If you regret it, you still have time to recover.

Find app packages

To back up, you need to know the installation path of that application.

The default installation path of built-in applications may be

/data/app/com.android.***/base.apk

Different brands of mobile phone systems have different default installation paths for built-in applications, so you might as well look it up.

To find the application package com.android.***installation path, you should enter the command:

./adb shell pm path com.android.***

The output result is as follows

package:/system/app/***/****.apk

Among them /system/app/***/****.apkis

Backup application

To back up the app package com.android.***, enter the command:

./adb pull /system/app//*.apk

If the operation is successful, the backed-up application package will be saved in adb.exea folder at the same level as the file on your computer. You can check it out.

Install app

To install the app, you should enter the command:

./adb install “C:\Users\username\Desktop\test\system_***_app_v3.8.1.apk”

Among them, system_***_app_v3.8.1.apkit is the location of the application file you want to install.

installation failed

There was a problem with the installation, the error message is as follows:

adb: failed to install C:\Users\***.apk: ....

Check to see what keywords the error is so you can determine the problem.

Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]

If this error occurs, you need to check Install the application through ADB on the ADB debugging page on the phone.

Failure [INSTALL_FAILED_VERSION_DOWNGRADE]

If this error occurs, it means that the application is already installed and needs to be uninstalled before trying again.

Cover application

If you are updating the application package, you do not need to uninstall it. Just use the following command to overwrite the installation:

./adb install -r -d “C:\Users\***.apk”

If the output result is like the following, it means the installation is successful.

Performing Streamed Install
Success

Go to the desktop to see if the new application has appeared.
Please add image description

Guess you like

Origin blog.csdn.net/zs1028/article/details/133032866