Many applications, such as Android adbd, require root privileges in order to run.
This is generally not a problem in development or test environments, as the application runs with the root user account.
However, when it comes time to deploy the application to production.
It is often necessary to change the default permissions on files and directories so that adbd can execute without being able to access system files.
If this cannot be done for some reason, then adbd may not be able to run at all in production builds.
How to Solve “adbd cannot run as root in production builds”?
adbd cannot run as root in production builds.
This is due to the way that Android handles permissions, which means that adbd will not be able to access certain files and resources as root.
Instead, it will need to use a different user account with appropriate permissions.
For example, SSH on Linux will run with the same user account as the root user.
This is called a “sudo” user, which allows adbd to access files and resources as the root user.
For solving this issue, you can use following methods:
Android: adbd cannot run as root in production builds
Android : ADB root is not working on emulator (cannot run as root in production builds)
Method 1 (Best Working Method)
Step1 Check if the phone has been rooted.
Perform win + R to open cmd.
Enter adb shell
Then $ becomes # which means root is successful.
Step2 Install adbd-insecure.apk on your phone.
Extraction code: nlv7
Use the abd command to install adb install adbd-insecure.apk
Step3 Go to settings.
Open the downloaded application.
Enable insecure adbd.
Enable at boot.
After setting, re-enter and type: adb root.
Install “adbd insecure” apk
Install adbd insecure apk to kill the adb server.
This will allow adbd to access files and resources as root without user permissions.
After installing, run “/system/bin/adb kill-server” in the terminal to create a new adbd process.
Then restart your phone and try to use adbd again.
Install Magisk app from Google play store
Magisk is an open source application that allows you to install and run any application on your device, without root privileges.
It’s a great solution for people who want to use their rooted devices with ease.
You have to start the shell on your device. Run the following command: ” system shell”
Then, run the following command to install Magisk: ” adb sideload magisk-v2017.1-beta.zip”
Wait for installation to complete then restart your phone and try to use adbd again.
Why “adbd cannot run as root in production builds” error occurs?
When a developer attempts to run an Android build using the adbd program as root, they will receive the “adbd cannot run as root in production builds” error.
This is because the adbd executable runs with elevated privileges, which is not allowed when building for release.
The safest way to run Android builds on a development device or emulator is to use the “su” command to create a temporary user account with elevated privileges and then use that account to run the adbd commands.
This is relatively safe because the temporary user account will not have elevated privileges.
Note that using a local user account with elevated privileges on your development machine is only allowed with ADB version 1.0.29 or higher, and may not work in all circumstances.
With ADB version 1.0.30 and higher, you can build the adbd executable with the –allow-root flag for convenience.
In this case, it is acceptable to run adbd with elevated privileges on a device or emulator running an earlier version of Android SDK Tools.