How to start Android console on VirtualBox emulator? - android

I've set up Android on a virtualbox, it boots and runs correctly.
However I'm trying to start its console so I can do netcfg and get the IP address, so I can try connecting the adb to it.
As the tutorials say, I tried pressing ALT + F1 but it has no effect. I've tried both the right and left ALT buttons but the console doesn't show up.
What am I doing wrong? Does Android have to be started in Debug mode to see the console?

No need for Debug mode for use the console. What a image are you use? Try [Ctrl]+Alt+F2/F3, or download other image.

Easiest way it's to open the Android Apps inside the VM and open a Terminal Emulator like you will do in your phone.
At least, I do it that way as ALT+F1 doesn't work for me.
Then, in the terminal emulator, you can use "su" to root and "netcfg" to know the IP of the VM so as to use it in "adb connect IP".
Hope it helps

Related

Android Emulator "Allow USB Debugging" dialog close right after showing

I'm trying to debug with Android R in Pixel emulated devices w/ PlayServices but the "Allow USB Debugging" dialog instantly close right after showing, so I can't click in "Allow" to AS connect to the AVD. I went to Developer options in Android to switch off and on again the USB debugging, but again the dialog close imediatelly right after showing. I tried kill/star ADB and unistalling all AS/user configs/etc and reinstalling again but didn't solve. Anyone has a clue?
Seems like this issue is related to your emulator's API version, after some testing I found that Pixel 4 API 30 have your problem, while others don't.
Another odd thing about the box is that it will ask you again for permission when you start a new session, even though I clicked the "always allow this device" button.
Wipe data and it will pop up and stay. Check the "always allow debugging on this device" box and you should be good to go.
get your public key from ~/.android/adbkey.pub
append it to /data/misc/adb/adb_keys of emulator (create it if not exist)
restart emulator
then you should connect directly.
ref:
How to solve ADB device unauthorized in Android ADB host device?
Try remove files adbkey and adbkey.pub in:
~/.android/adbkey/ on Linux
%UserProfile%\.android on Windows
%ANDROID_SDK_HOME%\.android on Windows, if set
adb kill-server
adb devices
Restart the emulator after wiping its data. Then the permission for "USB Debugging" should be given and it should show up as debuggable device.
The problem should only appear with google_apis_playstore devices, see here. Reason I think is, that the key files are only copied by adb, if no other keys already exist on the emulator. So may deleting the files on the emulator may also work.
I had the same issue. I tried to click "Allow" in time, but it was too fast on my PC. However, I noticed that after a cold boot this popup pops and doesn't hide for some time (may be due to load lag), so I managed to click it this way.
If someone still has this problem and the goal is to upload some file or apk, better upload it to google drive and download it by link in the emulator.
This problem occurs with Pixel emulators on API level 30, so choosing 31 instead will solve the issue.
I solved this problem by following steps:
Wipe emulator data
Start emulator again
Above steps resulted in no dialog at all, weird, then I looked at the Android Studio, the emulator was already connected.
After some experiments I found that x86 apis were showing this error so simply switching to x86_64 apis solved the problem :

How do I get Logcat for multiple devices running at the same time in Eclipse

I have two android devices connected to the same station. I would like to view the logcat for both while running them in debug mode in eclipse.
I have had SOME luck with the following steps:
Run the app on Device 1
Run the app on Device 2
Open a new window (window/new)
In the new window, open view logcat
About 40% of the time this results in in each eclipse window showing data from a different phone... but not always. It seems to be almost a luck-of-the-draw kind of thing. More often than not both windows show the same device. If I open device viewer and select a device in either window both change.
How can I do this all the time?
This is a very late reply but probably you didn't find a solution.
Solution:
Click Window ---> Show View ---> Other ---> Android ---> Devices.
Simply click on a device to switch to its logcat.
You can try to use adb in two different console windows to get the logcat for each one.
Example:
in console window 1: adb -s <device01_serial> logcat
in console window 2: adb -s <device02_serial> logcat
As takecare said.
This is how you can do it:
Find the device id's of Device 1 and Device 2. Do this by opening a shell prompt and typing the command
adb devices
You'll get a list of connected devices and their id's.
Run the command
adb -s [device_1_id] logcat
Where [device_1_id] is the device id of your Device 1 which you obtained in the first step.
Open another shell and do the same as in step 2, but for you Device 2.
I don't believe there's a good way to do this. You can approximate it though. One option is (as other answers have suggested) to use logcat from adb. This obviously isn't as pretty. Another is to run DDMS directly (instead of through Eclipse) for your second window. This gets you pretty close and gives you two logcat windows each with their own device selectors. The DDMS executable is found in the tools folder of your Android installation.
Here's the way I handle switching between device's logcat output using Juno M20120914-1800.
Unfortunately it is not automatic, but it is at least the most reliable way I've found yet, and once you get used to doing it, it's not that bad.
I click on the device icon in the toolbar.
I click on the device name.
Then I click on logcat again and it will show the device I selected.
It seems like this should be a feature, to be able to monitor more than one device/AVD at a time.

emulator doesn't show in device view in ddms

When I try to debug using one of the configurations that I've set up (for example Android233), the emulator never actually launches. I just see a little green icon in my task bar that says "launching Android233," but it never launches. I've let it sit there for hours and it never does anything. I don't know if this is related, but my emulators don't show in device view in the DDMS perspective. I have a physical Android device, which shows up in device view. My question is, what is happenin' and how can I fix it?
Thanks for taking the time to read my question :)
I thought I had the problem figured out, but it stopped working again. Here's more information: When I run my debug configuration, in the lower right corner of my Ecplipse windows it says:
"Launching MyDebugConfig (100%)" and then there's a green icon next to it.
I looked in task manager and the emulator is not in there. I looked in DDMS and my AVD is not listed and there is nothing in the LogCat or Thread or anything else for that matter. I have my debug configuration set to prompt me to pick a device, but it never does that. It just loads my AVD, even if I have my phone connected (which is visible in DDMS). I'm so stumped. I've had this problem since I started using Eclipse and I don't know what to do.
Thanks.
Go to DDMS Perspective =>Click View menu=>reset adb
If Your genymotion virtual device is not seen in android device monitor then just try this.
1. start android studio
2. start Android Device Monitor
3. Lastly start the genymotion virtual device it will appear
The emulator won't show up in the DDMS section until its running.
The emulator won't lunch probably because you misconfigured it, currently the lunch dialog of the emulator doesn't support error messages, however you can get the lunch stack trace while you try to lunch the emulator via Eclipse.
Disconnect your physical device, run your project and select the emulator. you should see an error message on DDMS console.
If you in Windows try run (after starting emulator)
adb.exe kill-server
adb.exe start-server
and wait for restarting your adb

Android: Emulator control is disabled in the DDMS perspective

I'm now facing a problem with Eclipse on Ubuntu. My device is connected, list by "adb devices" command and I can see the list of processes running in the Devices view. But all controls in the Emulator Control are disabled.
Does anyone know what may be the reason for this?
Thanks
First, make sure that the device is selected in the Devices view. You cannot use Emulator Control unless the device or emulator is selected.
If that does not help, close Eclipse, and try running DDMS outside of Eclipse -- there's a ddms shell script in the tools/ directory of wherever you installed the Android SDK.
If that does not help, run adb kill-server, followed by adb start-server, where adb should be in your platform-tools/ directory of your SDK installation. Then, try DDMS again.
If that does not help, reboot, then try DDMS again.
i found this with try and error .. it worked ..
As the new emulator got a side bar with icons .. the last icon down this list (the hamburger icon) click it .. then u will have the location latitude and longitude available to send to device
After unplugging USB connection from real device Emulator Control start work properly with Virtual devices
You can't send locations to actual devices, only emulators. You can mock your devices location however, in your code.
http://developer.android.com/training/location/location-testing.html

Reconnecting Emulator to Eclipse

My main problem with developing in Android is that the emulator seems to continually get disconnected from eclipse. This always happens the 2-3 time I try to upload my .apk from eclipse without rebooting the emulator. Eclipse indicates this with an empty DDMS ->Device section and logcat stays blank - sometimes I'm not sure if the new code made it on the device.
The only fix I have for this is to shut down eclipse, and restart it. With the restarting of Eclipse, on top of the emulator boot time, I can't get any momentum going in my development.
Is there a way to reconnect the emulator to eclipse without having to restart Eclipse or even the Emulator?
Update: There were a couple of answers that helped, particularly "reset adb" or Kill-server -> connect adb. However, sometimes even that is troublesome.
I am going to try Pentium10's suggestion of hooking up my G1 and using it as an emulator, but for now, I have found that if I don't see my logcat going, and the emulator is working (This is my biggest problem, because I am outputting all my debugging messages to log) then I can open up CMD and type adb logcat. This streams the log into the command window. Not nicely color coded, but nice enough for me to find my problems...
In eclipse go to Window->Show View->Other->Android->Devices. When your application is run go to this tab and you will see the emulator. If your emulator becomes unresponsive, in the devices tab you will see a down arrow at the right. Click the arrow and a context menu shows up. Hit the option Reset adb.
Just had to do this and it worked beautifully, but it did require you to reset the emulator - though I didn't wait to see if it reconnected on its own.
Try to call 'Reset adb' menu item from DDMS > Devices tab. It helps me in this case.
At most of the time you don't need to restart the emulator.
AFAIK the only workaround for this is to restart Eclipse (I always use this), or use a real phone.
Try adb kill-server, followed by an adb connect
I've had luck reconnecting to the disconnected emulator by entering an adb-over-tcp command line which you can look up in the docs. I think the address and port to use are the ones in the title bar of the emulator window, if not try the next higher port. Once it's back in adb devices eclipse should use it.
in terminal:
$adb kill-server && adb start-server

Categories

Resources