Writing on android emulator file system - android

I am having some trouble interacting with the android emulator. My goal is to overwrite the hosts file on the emulated device but I am stuck.
I have used the adb command line tool as suggested in most places. Symptoms:
$ adb root
$ adb remount
> Not running as root. Try "adb root" first.
There is no output from the adb root command, and it seems to have no effect.
$ adb shell
emu$ su
emu> su: not found
I have found no way to push files to the device. Not even using the -writable-system when launching the emulator or restarting the adbd server... I have also tried running the script mentioned in this other so answer, but with no success.
Further information:
Host machine OS: Windows
Android versions on emulator: Android 8.0 and 7.1.1
Emulated device: Nexus 5

I leave this here, in case anybody else encounters the same problem.
After playing around, adb finally works correctly with the emulator. My issue was resolved when I changed the emulated device for another model (in my case Nexus 6).

Related

adb disable-verity - NOT Found

I am trying DUT debugging using adb in my ubuntu machine 20+.
when I try to disable-verity, I am getting the following error "/system/bin/sh disable-verity not found"
I tried reinstalling adb again , and I am running to the same issue.
I ran the DUT in different windows setups, it is running fine though
Anything I am missing?
Another thing I noted is: running just adb is giving segmentation fault, however running adb with other arguements is running fine. ie adb devices

Expo - Error running adb: more than one device/emulator

I am running macOS Catalina, and have one Android emulator set up in the Android Virtual Device Manager.
Before starting the emulator, on a freshly rebooted system, if I run adb devices I get:
List of devices attached
emulator-5562 offline
After starting the emulator, adb devices returns:
List of devices attached
emulator-5554 device
emulator-5562 offline
If I fire up Expo and try to run on the Android emulator, I get this error:
Couldn't start project on Android: Error running adb: more than one device/emulator
It looks like the offline emulator-5562 is the problem here? But it's still there even after rebooting my computer. All the advice I've read (i.e. adb kill-server and adb restart-server) makes no difference. There are no Android devices connected via USB.
How can I delete the "offline" device? Or alternatively, how can I point Expo to the one actual Android emulator I have running?
Try this:adb -s emulator-5554 <command>

No device found (Nexus 5X with Android 7.1.2) in Android Studio 2.3.1 running under Ubuntu 16.04 Linux

After I have updated my Nexus 5X to Android 7.1.2, Android Studio is unable to see my device. I should mention that the device works fine (also for transfering files).
I should mention that this is happening only with Nexus 5x. I have also a Samsung S4 and there is no problem with it.
Running in terminal the following command:
>adb devices
I obtain the following message.
List of devices attached
???????????? no permissions
I have to mention that everything went fine and the phone was recognized by adb when I used the previous version (Android 7.1.1) (also now the debug mode is activated on the phone).
I am using Android Studio 2.3.1.
I should mention that my operating system is Ubuntu 16.04
You can just change USB connection to PTP or MTP. Works with my Nexus 5x device
After several unsuccessful attempts, I have decided to give it one more try (from Linux terminal and not from the terminal window of Android Studio).
Switch to root and then run the following commands:
>adb kill-server
and then
>adb start-server
Which gave the following output:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
Afterwards I wrote:
adb devices
which gave as response:
List of devices attached
01e0fbbdcccf32c9 unauthorized
And the screen of permission appeared on the Nexus 5X device, asking if I want to allow to debug.
Problem solved!
The accepted solution works only when you are connecting to adb as a root.
When I'm not a root I get 01e0fbbdcccf32c9 no permissions instead of 01e0fbbdcccf32c9 unauthorized
So I need to connect to 'adb' as a root, the solution for me was
$ sudo adb kill-server
$ sudo adb start-server
$ sudo adb devices
After doing these commands on the terminal, I get
List of devices attached
01e0fbbdcccf32c9 unauthorized
and a window of permissions will be opened on the phone.

adb : Cannot send commands to my device from the command line

I'm trying to enable CheckJNI in order to debug my native code (see http://android-developers.blogspot.ch/2011/07/debugging-android-jni-with-checkjni.html).
I have a Galaxy S3 with the google USB drivers installed. I can install app and see my device when I use eclipse.
My problem is that I can't send any commands from cmd.exe to my device (it says "error : device not found"). I tried to send adb shell setprop debug.checkjni 1 but I always got the same error.
I tried a different USB port, a different USB cable and I tried to start cmd.exe as an Administrator but I always got the same result. Anyone has had the same problem ? Any idea what I can do ?
Thanks
try restarting ur device and computer also
then execute following commands:
adb kill-server
adb start-server
and then see if it show device using
adb devices
for available device
then you can run commands in ur device using
adb shell ......
After trying to send commands to 2 differents devices on 2 different computers with Windows 7, I finally installed a virtual machine with Ubuntu and there I could access my devices with command lines.

How to run or debug on android phone instead of emulator?

Android emulator is so slow that it is not possible to test run applications. Is there anyway to debug/run applications on real phone with IDE instead of emulator?
You can generally switch on USB debugging on your handset and connect it up to your PC over USB. The handset will then appear to adb in the same way as an emulator. You might need to download drivers from your handset manufacturer for your phone.
On my HTC desire the setting is under:
Settings -> Applications -> Development -> USB Debugging
Enable USB-Debugging on your phone. Connect it to your computer. ADB should recognize it and you can use it the same way as a virtual device.
If ./adb devices lists your phone as a lot of question marks, then it is lacking some permissions. To fix this, restart the adb server as root. Something on the line of:
~$ ./adb devices
List of devices attached
emulator-5554 device
????????????? device <--- your phone
~$ sudo -s
~# ./adb kill-server
~# ./adb devices
List of devices attached
emulator-5554 device
1232345345345 device <--- your phone
I realize the context is for Windows, but I had the same issue on Linux (Fedora). Creating a new file in /etc/udev/rules.d/ was necessary (and restarting adb as Hyperboreus indicates).
This is indicated clearly at http://developer.android.com/tools/device.html.
fwiw
For Windows Users:
1. Go to Command Prompt
2. Type cd /path/to/adb.exe
3. Type adb.exe devices
4. Type adb.exe kill-server
5. Type again adb.exe devices
If you get your Device, Its fine. If not, Try once again.

Categories

Resources