How to Resolve “/system/bin/sh adb inaccessible” Error

As a developer working with Android applications, you might have encountered the “/system/bin/sh adb inaccessible” error. This error can be frustrating, especially when you’re trying to deploy your app on a virtual device using Android Studio. In this blog post, we’ll delve into the details of this issue and provide you with a comprehensive solution to fix it.

Understanding the Problem:

When you’re working on an Android project and using the Android Debug Bridge (ADB) to push files to a device, you might have executed a command similar to this:

adb push <project_root_folder>/app/build/outputs/apk/app-debug.apk data/local/tmp/testjar/load.apk

However, instead of success, you encountered the error:

/system/bin/sh: adb: not found

This error message can be perplexing, but it usually occurs due to a simple misunderstanding of how ADB works.

The Cause of the Error:

The key issue here is the misunderstanding of where you should run the ADB commands. When you run adb shell, you are effectively entering the Android device’s shell environment, and you cannot use adb commands from there. ADB is designed to be executed on your host computer, not the Android device itself.

The Solution:

To resolve this issue, follow these steps:

  1. Open your command prompt (CMD) or terminal on your host computer, not in the Android device’s shell.
  2. Navigate to the directory where the ADB executable is located. If you’ve installed Android Studio, the ADB executable should be in the platform-tools directory.
cd path/to/your/platform-tools

Now you can run your ADB commands, including the adb push command, from the host computer.

adb push <project_root_folder>/app/build/outputs/apk/app-debug.apk data/local/tmp/testjar/load.apk

By following these steps, you ensure that you’re using ADB on your host computer and not within the Android device’s shell, which is the root cause of the “/system/bin/sh adb inaccessible” error.

Update Information:

In your update, you mentioned that you are deploying your app on a virtual device (Nexus 5) and using Android Studio 2.2.3 on Windows 10. It’s essential to clarify that the solution provided above remains the same regardless of the environment. Ensure that you are running ADB commands from your host computer’s command prompt, and you should be able to resolve this error.

Conclusion:

The “/system/bin/sh adb inaccessible” error can be puzzling, but it’s primarily a result of running ADB commands in the wrong environment. Understanding that ADB commands should be executed on your host computer, not within the Android device’s shell, is the key to resolving this issue. By following the provided solution, you can overcome this error and continue developing and deploying your Android applications with ease. Happy coding!

Bipul author of nerdy tutorial
Bipul

Hello my name is Bipul, I love write solution about programming languages.

Articles: 146

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *