How to start GUI from command line in Android-x86 - android

I managed to get Android-x86 running in VMware player, but if I need to go to the command line by pressing Alt+F1 I cannot go back to the GUI. How do I restart the GUI from the command line?

To start the GUI, I had to select VboxVGA instead of VMSVGA in the VirtualBox display settings of the virtual machine.
Note: This is a solution to make it work with VirtualBox in case it helps someone who finds this question. It is possible that the solution to make it work with VMware player is similar.
I also found this information here:
Mandatory: Unless guest additions are installed, change the default
VMSVGA to VBoxVGA.

To fix this, you have to open the Virtual Machine Settings for your Android virtual machine and then go to the Display settings on the Hardware tab. Make sure that 3D acceleration is ticked! Start your Android virtual machine and wait maybe up to 10 seconds on the command line. It will then boot to Android GUI.

Adding another optional solution, because even though the most voted solution (written by JAGJIT DHALIWAL) helped me, it didn't do the whole job.
When trying to install android x86 8.1 (oreo) the suggested answer didn't do the trick and the my android VM was stuck on GUI initialization, after viewing this video my problem was solved.
What I had to do is:
to start the vm in debug mode, or open the CLI before GUI init first.
remount mnt: mount -o remount,rw /mnt
edit /mnt/grub/menu.lst (vi /mnt/grub/menu.lst)
appending this code to the first option (the first line starthing with kernel) nomodeset xforcevesa
save the file (:wq or :x)
reboot and the VM boots like magic with GUI

To go back to GUI try use Alt+F7

Related

Getting "error: device offline" from adb.exe in Android Player SDK / Setting Up Unity Remote 5 (Solved)

First of all, this is my first post here and I'm a beginner so my apologies if this ends up being a stupid question or my format is wrong, but any help is appreciated.
Essentially my problem is in trying to set up Unity Remote 5 for debugging in Unity. However, I believe I've finally narrowed it down. The error I'm getting now seems clear:
CommandInvokationFailure: Unity Remote requirements check failed
C:/Program Files/Unity/Hub/Editors/2019.4.17f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK\platform-tools\adb.exe forward tcp:7201 tcp:7201
stderr[ error: device offline]
stdout[]
exit code: 1
I've looked into this error and came upon this: https://stackoverflow.com/a/39031464/14948855 which seems like it might be useful to me, however the issue is I don't know how to run the commands he suggested and stack overflow made it clear it didn't want me posting a question as a response to that question and I don't have enough prestige to comment.
I'm trying to run "sudo adb kill-server" from an ubuntu linux terminal on windows from the directory abd is in (C:\Program Files\Unity\Hub\Editors\2019.4.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools), but it won't run.
proof command not found
I've tried adding it to the path on my computer: I added the directory listed above to "Path" in my "Environment Variables".
My phone is plugged in, I've disabled and reenabled developer mode and usb debugging, and restarted Unity and my phone several times. Any help with running this command in ubuntu or cmd, or even the greater problem of Unity Remote 5 would be fabulous.
Thank you.
Edit: here's a better image showing my issue:
image showing how I've tried to add the folder to the path but it still can't be reached
Final Update:
All my problems have been solved, here's how I got unity remote 5 for android working for posterity:
step 1) Make sure phone is in developper mode (go to "about phone" in settings, tap build number 7 times).
step 2) Make sure "USB debugging" is turned on in developer options.
step 3) Make sure Unity is updated to the most recent supported version through Unity Hub (might not be required but I did this step).
step 3) Download android support module through Unity Hub.
note: if you downloaded current Unity version from the Unity website rather than through Unity Hub, it doesn't seem to let you add modules to it through Unity Hub.
step 4) The sdk path Unity specifies by default is wrong for some reason, so in preferences->external tools, disable the default path and paste in the right directory (should be something like: C:\Program Files\Unity\Hub\Editors\2019.4.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK) to be safe I did this for the JDK, NDK and Gradle too.
step 5) When you plug in phone, pull down your notifications, hit "tap to change USB options" and make sure phone is in "camera" mode or some variation. For me it was "Photo transfer".
Note: if you don't have the option to change USB options, try different usb ports/cables, if those don't work you might have debris in your charging port, clean it out with a dab of 91% or 99% rubbing alcohol and a tooth brush/tweezers (this will also make charger sit more snug in phone)
That might be enough to get it working for you, if not...
step 6) (Not sure if necessary) May need to update phone drivers in device manager on windows.
step 7) If Unity gives an adb error saying too many devices connected, it's possible you have a daemon running in the background which adb is picking up as an android emulator because it's using a port greater than 5555. It seems adb checks open ports above port 5555, and assumes anything it finds is an emulator. To check this, as indicated in my original question, and as stated here: https://stackoverflow.com/a/39031464/14948855, in cmd on windows use adb devices (if ur on linux may need to use sudo) to get a list of all devices being detected by adb. (Also use "adb kill-server" to reset it.) If there is an emulator being detected, it should include the port it's using in its name, in my case it was "emulator-5562" in port 5562, which was apparently actually NTKDaemon from Native Instuments, a random music production program I've only used once so far. I'd suggest googling the emulator port you find to try and narrow down the process taking that port. The only thing left to do is to kill the process running in the port. I found NTKDaemon in task manager and also disabled it activating on startup because that's just evil imo.
And that should be it. Hope that works for you if you're here for help.
(btw in terms of my original question, I was able to access adb.exe by changing the directory in cmd, but I still never found why adding the directory to the path didn't work, so if anyone has an answer to that I would be interested)

Intel Virtualization Problems (Android Studio)

So, I am trying to use the Android Device Emulator (AVD), but it has the typical error: "hax kernel module is not installed". However, I reinstalled the Intel HAXM 1.1.5 dozens of times. I have that option enabled in the BIOS, and I can use virtualization in the Oracle VM VirtualBox. I even downloaded a program to test if my PC supported virtualization and went to the Intel web page to see if my processor was able to do that. It can.
I don't know why is this giving me such a problem. I tried many videos and googled and googled again, but noone seems to have the same problem as I do. However, I notice that when I try to run "sc query intelhaxm", it always says it's not installed (error code 1060). I always reset my PC after installing the HAXM.
My CPU is a Intel Core i3 M 330 (3M Cache, 2.13Ghz) (intel specs) and, if needed, I have a HP Pavillion dv6-2160ep (specs).
Thanks,
Ric
Have you used the command lines
bcdedit /set hypervisorlaunchtype off
bcdedit /set nx AlwaysOn
Turned off avast if you have it
Downloaded the HAXM from Intel and not thru AVD
https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager-end-user-license-agreement
So, I kinda found a solution that lets me use the service intelhaxm. I just can't find a place where someone did what I did. Anyway, I'm going to post my solution, for other persons with the same problem as me don't get the trouble I had. So:
Before I say anything, I'm using Windows 7 and I'm portuguese, so I'm guessing the name of the directory's/options:
Install the Intel HAXM normally and then restart your computer.
After that, browse to the Intel HAXM folder ("C:\Program Files or Program Files (x86)\Intel\HAXM").
Right click in the window while holding Shift. Click on "Open command prompt here".
Write "PnPUtil.exe -i -a intelhaxm.inf". If it asks you to accept it, click OK.
After that, right click in the intelhaxm.inf file and select Install.
At this point, if you type "sc query intelhaxm" in the command prompt, it should show info about the service. However, it doesn't have a certificate, and you can't still use it.
Download Driver Signature Enforcement Overrider here.
Open it, select "Enable Test Mode" and press Next. After it's done, restart your computer.
If you did everything correct, there should be a watermark at the desktop saying something like "Test Mode". Open the same program again, but now select "Sign a System File".
In the text field, paste the complete path to the intelhaxm.sys. Something like this: "C:\Program Files or Program Files (x86)\Intel\HAXM\intelhaxm.sys".
After that, open the command prompt again the same way you did above.
Type "sc delete intelhaxm" and then install the .inf file the same way you did.
Now, try to type "sc start intelhaxm". It takes more time than usual, but now it should be running.
This is what I did to get it working. However, it only works while Windows is in Test Mode. If you want to get rid of the watermark, launch the same program again and choose "Remove Watermark".
If after you turn off the computer and go back later you can't launch your AVD, type "sc start intelhaxm" in the search bar of the Start Menu.

Android emulator won't shut down

The emulator starts up fine. But when you long-press the power button (or F7) and choose "Power off", it displays a "Shutting down" message which remains on-screen forever and the emulator won't actually shut down.
I can close the emulator window or kill its process. But I'm wondering if this is the correct way to shut down an Android emulator.
According to the documentation I found at google, simply closing the
emulator window is the correct way to shut the emulator down.
To stop an emulator instance, just close the emulator's window.
Source: Starting and Stopping the Emulator
Open Android Studio
Go AVD Manager
Go Actions Tab
Click arrow
You will see stop
Click and emulator shut down :)
If the device is stopped in a bad state, this may persist when relaunching the emulator. To get around this, simply select 'Cold Boot Now' from the virtual device's drop down menu in the manager.
I'm running Android Studio Chipmunk 2021.2.1 and most of the solutions in this thread no longer work.
adb solution
What does work is using adb to shutdown the emulated device:
adb reboot -p
(The -p stands for power off, so it's not really a "reboot")
If you have multiple devices attached you'll need to specify which one:
adb -s DEVICE_SERIAL reboot -p
(You can find the list of device serial numbers by running adb devices)
Alternate pkill solution
Shutting down via adb is the clean way to shutdown the device. If for some reason that doesn't work, you can kill the emulator by running:
pkill qemu
This will kill every running instance of QEMU on your computer (QEMU is what the Android Emulator uses under-the-hood). pkill(1) is installed on most computers, but you may have to install it if it's not built-in.
Okay so do this:
Open Android Studio
2.Go to AVD Manager
3.Select Your Emulator and Cold Boot Now
On Mac, you can simply use the shortcut Cmd + w to close the emulator window (either window or docked mode). It would automatically shut down the emulator.
I've verified this for Android Studio Bumblebee | 2021.1.1 Patch 3
Open Virtual Device Manager, locate the virtual device you are concerning, check "Cold Boot Now" on the drop down menu of actions column of it.
This is for Mac Users.
Click on android emulator.
Go to top menu
Click on item which is shown (there will only be one)
Click on Stop/Quit from the dropdown.
It will then save its present state and then it will shut down.
No idea
I really don't know.
Here's what I do know.
Getting a list of running Android instances
You can get a list of running Android instances by entering this command:
adb devices
What else you can try
Now you can visit "How I shutdown Android phone with adb command?" and try all the proposed solutions.
I don't know whether any of them work. Please leave a comment below and inform us.
More thoughts
You can connect to a running emulator by entering this command:
adb shell
Now you can enter Unix-like shell commands which will do things. These are similar to the usual Linux shell commands.
Maybe the following will work? But, does it truly shut down, or does it reboot?
sync && reboot -p
In fact, does any "shut down" command work, or do they all just cause the running Android instance to reboot?
Please file a bug report
Someone should file a bug report, in the Android issue tracker, against the current version of the Android emulator — plus one of Google's newest available emulator ROMs. Once you do so, please leave a comment below and provide us with a link to the bug report.
If you were taking advantage of the emulator's "snapshot" feature, you probably didn't need to shut Android down in the first place.
If the feature is enabled, closing the emulator window should hibernate the emulator's state to disk. (Source.) This should make the emulator start up quicker next time.
You can enable snapshot support using AVD Manager's "Edit..." button.
If you want to enable snapshot support, you'll probably need to disable the "Use Host GPU" feature. I believe that the two features are mutually incompatible.
I tried to hold click on right side button for 3-5 seconds and choose to turn it off. It works for me.
Found an easy solution: from android device manager-> when having emulator in question highlighted, click on ... (three dots) on top right-> select Start with factory defaults.
Goto AVD manager (Tools menu > AVD Manager), in the actions section, stop and then wipe data
Now click play button in the same window
AVD is running on port 5555, the easiest way to close it is using the below command line:
sudo lsof -n -i :5555
It will show the PID that is running your AVD, use -9 or -15 to kill the process
kill -9 [PID]
On Windows 11, the emulator often refuses to shutdown, and just stays frozen. Killing the qemu-system process in Task Manager while AndroidStudio is running resolves the issue.
if you are using last version at Android Studio.
Deleted this file.
snapshot.lock.lock
multiinstance.lock
hardware-qemu.uni.loc
from
.android/avd/Pixel_3a_API_29.avd

Trying to use AVD properly in eclipse

I'm trying to test my application but I don't know how to use the AVD I created. I mean pressing buttons on the right and clicking on the "touchscreen" is easy, but how do i rotate/move the emulator on the different axes? I'm trying to see if the acceelerometer stuff works properly.
Thanks in advance!
Owen Fraser-Green answered here. Previous post copyrighted?? Maybe.
Hope, it will help!
According to Owen Fraser-Green's answer here
The Android emulator doesn't support it itself but OpenIntents' SensorSimulator fills the void. Download and unpack the zip file, then start the standalone jar file:
$ java -jar bin/sensorsimulator.jar
Next, install SensorSimulatorSettings on the emulator using the adb tool which comes with the SDK:
$ adb -s <emulator device> install bin/SensorSimulatorSettings.apk
(run adb devices to find the emulator device name). Finally, run the installed SensorSimulatorSettings app in the emulator and enter the IP address 10.0.2.2 (despite what the SensorSimulator application might suggest. This is an alias to the loopback device of the development host so should always be valid.
The OpenIntents SensorSimulator lets you simulate sensor data with
the mouse in real time. It currently supports accelerometer, compass,
orientation, and temperature sensors

Android SDK and AVD Manager, Stalls and/or never finishes

Recorded for posterity.
I saw only a few posts around the net and all suggest to use HTTP instead of HTTPS and there were several ways to do this. None of them discussed Windows only Linux. Well this did not work for me and I could not find any way to get the files downloaded to my Windows Vista 64 machine.
So after much work I manually downloaded them and got them to work. I did this by putting it on a machine that did work and reading the repository.xml file and downloading them.
https://dl-ssl.google.com/android/repository/google-apis-4_r02.zip
Unzipped it and moved the top directory into
android-sdk-windows/add-ons
and
https://dl-ssl.google.com/android/repository/android-1.6_r02-windows.zip
I then extracted them and renamed the top directory android-1.6 (it is at least one level below the unzipped directory) and moved it to
the platforms directory
Then rebooted my machine and it seems to work.
Hope this helps someone.
Julian
you need to disable auto tuning on your network adapter. i was going crazy trying to figure this out.
run this in an administrator command prompt (right click command prompt from the start menu, run as administrator)
netsh interface tcp set global autotuning=disabled
restart avd manager
On Mac OS X, the corresponding command for turning off auto tuning is:
sudo sysctl -w net.inet.tcp.rfc1323=0
This fixed the issue for me.
Source: Handling TCP Window Scaling

Categories

Resources