'error: device not found' while connected to device through adb shell


Question

Trying to deodex my Samsung Galaxy S4 (SC-04E).



My device shows up upon adb devices, and I am able to successfully connect and su with adb shell. In shell:



C:\Users\username>adb devices
List of devices attached
905859f9 device
C:\Users\username>adb shell
shell@SC-04E: $ adb pull /system/app app/
error: device not found
shell@SC-04E: $ su
root@SC-04E:/# adb pull /system/app app/
error: device not found


I have no idea why I am getting this message. USB debugging enabled and confirmed, MTP on, unknown sources on (off tested as well), and latest adb USB driver installed (also tried reinstalling/updating). I have also tried rebooting my computer and device several times, and tried different USB ports (3.0, 2.0, etc).



Google searches only show me solutions for people who lacked the obvious settings (USB debugging) or their device not showing up at all upon adb devices. A device clearly is found, as it is connected to a device.


Answer

You must run adb on your host PC instead of your device. The adb is a host program that operates on another device. To pull data from your phone, make sure you run adb like this:



C:\Windows\system32>adb pull something yourPC


If you run adb shell then you're entering your phone, where you are actually running /system/bin/adb instead of adb.exe on your Windows PC. Your phone is a client device, not the host device.

If you want to pull a file from a root-required place, you must first copy it to somewhere else before pulling it out. Like this



C:\Windows\system32>adb shell
shell@SC-04E:/ $ su
root@SC-04E:/ # cp /path/to/somefile /sdcard/somefile
root@SC-04E:/ # exit
shell@SC-04E:/ $ exit
C:\Windows\system32>adb pull /sdcard/somefile D:\somefile


For your question about why adb returns nothing, you can try this to find out.

Plug in another adb-enabled phone using an OTG cable on your primary phone (in your case, Galaxy S4) and get a terminal emulator. Type in adb devices and run on your primary phone you can see it like this.



root@SC-04E:/ # adb devices
List of devices attached
12345678 device

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes