Android emulator with custom build does not accept keyboard entry - android-emulator

I have a custom Android image using a custom built goldfish kernel. I have been using the Emulator for SW development.
emulator -kernel out/target/product/atom/kernel
When I upgraded to SDK 20 I no longer get keyboard input from neither the host nor the graphic keyboard. This used to work. I have seen the comments about setting the hw.keyboard property=yes. I am not able to find a sequence of operations that work.
a) try and launch the emulator and force my hardware config
emulator -verbose -kernel out/target/product/atom/kernel -qemu -android-hw /home/jgrecco/work/ics-4.0.4/out/target/product/atom/hardware-qemu.ini
The hardware-qemu gets overwritten and the hw.keyboard option is no.
b) Create an AVD and have it load my custom kernel and image
ex: android create avd --force -b x86 -n aal_emul -t 3
emulator -kernel out/target/product/atom/kernel -show-kernel #aal_emul
But have not been able to get the AVD to boot my custom image. It seems to boot a default image. I've tried copying over the img files but no luck
c) Tried modifying the default hardware.ini settings
ics-4.0.4/external/qemu/android/avd/hardware-properties.ini with no effect.
many many other variants.
If someone could make any of the solutions above work or tell me one that will I would appreciate it. BTW this is for x86 atom.
TIA

After much experimentation, Googling, lots of cursing inaccurate (out of date) documentation and updating all of my sources (fighting with repo sync hangs – rant off), I’ve figured out a work around. I thought I would post this for the benefit of others.
The basic problem was that after upgrading to SDK 20 I no longer could input to an application using ANY means (real or emulator keyboard). This only occurred when loading my own custom image "lunch #; emulator -kernel out/target/product/...". None of the attempts to override the hw.keyboard property as described above worked for me.
The work around I’ve found is to change the setting in the emulator at runtime. Settings->Language & input->default_Hardware Physical keyboard (OFF). While I can’t use the host keyboard I can now use the emulator keyboard for input.

Try setting 'hw.keyboard=true' in the file config.ini which exists alongside hardware-qemu.ini.
This overrides the default value in hardware-qemu.ini and shouldn't be overwritten.

Related

Unity Graphics White Screen Problem (Graphics Problem?)

My Unity Editor was showing a blank white screen when trying to start a project. Image here:
This is for the Karting Microgame. When it loads it only displays a blank screen. When clicking the play button there is sound but nothing showing on the screen. This issue also occurs for other Unity3D microgames. I suspect it is an error with the graphics setup or maybe a bug?
Technical details:
Dell G15 laptop
Ubuntu 20.04
Unity version 2020.3.21f1, installed via Unity Hub
NVIDIA Graphics Card (NVIDIA GeForce RTX 3060 GPU)
NVDIA Driver Version 470 (https://packages.ubuntu.com/focal/nvidia-driver-470)
I also have an Intel integrated graphics card on my machine. Tried switching to integrated graphics via the sudo prime-select intel command but it didn't work. Also tried installing Dell G15 graphics drivers from the Dell website but it seems like they only have Windows graphics drivers. Currently the screen is still blank.
Relevant links:
Unity forum discussion, have the exact same problem except for Ubuntu:
https://forum.unity.com/threads/uni...n-problem-might-know-the-real-problem.545441/
Dell graphics driver link, but seems to only have for Windows:
https://www.dell.com/support/home/en-us/product-support/product/g-series-15-5510-laptop/drivers
Tutorial on switching graphics cards. First tried updating my drivers via the ubuntu-drivers command from my existing 470 version to the recommended 510 version, but ran into an error saying my computer holds broken packages. Then tried switching to Intel integrated graphics card via the prime-select command but it caused my GUI to break (had to switch back to NVIDIA via the command line.)
https://www.linuxbabe.com/desktop-linux/switch-intel-nvidia-graphics-card-ubuntu
Any help would be appreciated.
Open windows in safe mode and try again also there might be other programs open that are causing the blank screen for example vpn could cause it
I need to share this!
Try this:
In your project, delete the Library folder. I found that CurrentLayout-default.dwlt in particular must be deleted, so you can try that first if your project is big and want to avoid long rebuilding times.
In ~/.config/unity3d/Preferences/Editor-5.x, delete the Layouts folder
In ~/.config/unity3d, delete the Browser folder
In ~/.config/unity3d, delete the Editor folder (there is one sub-folder per editor version but the serial number cannot be trivially matched with a human-readable version, so maybe just delete the whole folder)
Restart the project
I found 1, 2 & 3 to work in my case, and only 1+2 or 2+3 not to work. At least it should work when installing a new editor / re-installing an editor version. I also did 4 at some point so it may be needed for editor versions already installed. I did 2 at the beginning so not sure if required.

Flutter Windows Desktop app gets stuck on white screen after msix installation

Background
I just developed my first flutter desktop app for a windows machine. The app is working fine while developing/debugging it, but I am trying to test it as an application in release mode.
What’s done
I created an msix using pub msix.
For signing, I have tried both my
own certificate and the test certificate that comes with msix
packages by default.
I have tried both stable and beta channels.
Actual Problem
When I install the app on the other system (or even on the actual system where I debugged the app). I can install the msix setup successfully I can see my app listed in the apps, but when I try to open it, it is stuck on a blank/white screen. There is no UI rendered. And if I try to maximize the window, it goes to App not responding state.
Any help will be really appreciated.
Thanks in advance.
Update / New Finding
After going through the links provided by Yehuda Kremer and pulling my hair for a few days, I found the answer in this tweet
https://twitter.com/FilledStacks/status/1436280577439715338?s=20
So the main issue is that app is using some absolute paths that don't work on other machines (after release)
1- My app was using a database, so I have made sure that that database path is relative to the application document directory.
2- Now the build is also referring to some dependencies and their paths are also absolute. I have noticed a flag CMAKE_INSTALL_LOCAL_ONLY in the cmake_install.cmake but that flag is not being set anywhere.
Here is the log of flutter build windows -v
https://pastebin.com/LAeshUMY
-- Now I am looking for a proper way to convert all the paths to relative so that the build is ready for installation on different machines, instead of local installation only.
I have found the solution.
The main problem was that the app was looking for some dependencies and it was unable to find them. As mentioned here.
The reason for not finding that in release mode can be one of the following,
You are using some dll (package that depends on a dll) that is available on a specific path in your system, but when you are release the app that (absolute) path is not valid anymore.
You are adding some asset with absolute path (that is only applicable to your system).
Solution:
If it is a dll, you should be adding that to the release folder. In my case it was sqlite3.dll
If it is some other asset then you should always use the relative path.
You mentioned msix package, let see if the problem is in the app or in the packaging process
run flutter build windows without the flutter pub run msix:create, then run the created .exe file to see if its work.
btw this issue mention here: https://github.com/flutter/flutter/issues/74507
and here (the 'maximizing' problem): Black screen appears on maximizing and minimizing flutter desktop app

Getting Flutter doctor to work

How do I get flutter doctor on my Windows 10 laptop to work, please?
I followed the guidelines here,
Used git to clone the flutter repository,
git clone -b alpha https://github.com/flutter/flutter.git,
Tried adding "C:\Users\<user>\flutter\bin" to my path in the Control Panel
and then in an Admin Powershell, tried executing flutter doctor.
At first, it just hung.
After googling for help, I tried deleting the contents of the
C:\Users\<user>\flutter\bin\cache folder and re-executing flutter doctor but to no avail.
Then, I tried deleting all of flutter and cloning again but flutter doctor just hung again but with, Updating flutter tool.
Tried a few different Googled PATH-adding ideas (that seems to be a complex and disputed area.)
Got a new message: Waiting for another flutter command to release the startuplock
The latest state is that flutter doctor still just hangs but without any message.
I suspect the problem lies in the new Path not being properly recognised (in the registers??)
Can anyone help please?
Well, the issue is not clear enough, but this might be solution, if your flutter doctor is stuck, it might be due to Background Intelligent Transfer Service is disabled, in order to check for yourself, do the following:
Click on the start menu, and then start typing services.
Launch the services and look for Background Intelligent Transfer Service and make sure it is running.
At this stage I believe you will find it disabled for some reason, just right click on it and go to properties and start the service, also change the startup type to automatic.
I can not think of other reasons that might prevent flutter doctor to run for the first time on a Windows machine other than that honestly.
I know this question is a little bit old. Here is a solution that worked for me. Run the Command Prompt as an admin solved the issue for me.
For Windows user check to see if the unzipped flutter folder is read only. (i.e right click the folder then properties then in the attributes section untick the readonly property then apply this change to the folder along with the sub-folders then ok and thats it. Worked for me.
Some errors I got and how I fixed it:
(ERROR 1):
[flutter] flutter doctor -v 'crumb' is not recognized as an internal or external command, operable program or batch file.
Error: Unable to find git in your PATH. exit code 1
(Fix) - Go to flutter installation folder and inside flutter/bin edit the flutter.bat file using a text editor and remove the line (20) that says:
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
The code should look like this on those lines:
REM If available, add location of bundled mingit to PATH
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
Save and Run flutter doctor and everything should work fine.
(ERROR 2):
flutter doctor takes too long
(Fix) - I downloaded the previous version of the sdk it worked like a charm.
(ERROR 3):
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.
(Fix):
Open Android Studio
Tools Menu, SDK Manager
In the window that comes up there are inner panels, choose SDK Tools panel
Tick Android SDK Command-line Tools
Choose Apply button near the bottom of the window
This worked.
(ERROR 4):
The term 'flutter' is not recognized as the name of a cmdlet, function, script file, or operable program.
(Fix) - Put the correct part in the env variables. I had put D:\flutter instead of D:\flutter\bin. That worked.
I got a solution that worked for me
initially i had downloaded the 2.2.5 SDK which gave the forever run error so i went back and downloaded the previous version ie 2.2.2 it worked like a charm
The Flutter SDK is installed in a protected folder and may not function correctly. Please move the SDK to a location that is user-writable without Administration permissions and restart.

Android Emulator - invalid command-line parameter:

When I try to launch my Android Virtual Device, I get the following error.
Files\Android\android-sdk-windows\tools/emulator-arm.exe.
Hint: use '#foo' to launch a virtual device named 'foo'.
Please use -help for more information.
I have been using the emulator for months, and I just downloaded new updates from SDK/AVD Manager.
This problem is caused by blank spaces in the path you setup in the Android SDK. The solution is that you should move the folder of the Android SDK to a place without spaces, in your case:
E:\andriod-sdk-windows
or
D:\abc\xyz\android-sdk-windows
Please refer to the Stack Overflow post Starting the Android emulator in SDK tools, revision 12 for a solution. It did not come up in the search, but it did correct my problem. The space in the path name (PROGRAM FILES) seems to be causing the problem. I took the renaming suggestion to change the path name to PROGRA~1, and my problem was resolved.
It looks like someone already reported this problem, Issue 18317: Emulator in R12 doesn't properly invoke emulator-arm.exe if the install path as a space in it
... to summarize:
Yes, there will be a fix. We're working on it.
The primary workaround is install in a path with no spaces, e.g. c:\android.
If that's not a choice, the second workaround right now is to use the "short path" Windows notation, e.g. "C:\PROGRA~1" either on
command lines or in the Eclipse preferences. Remember that the number might
change depending on your directories; you can use "dir /X c:\" in
cmd.exe to see the exact short path for a given directory.
We'll have to wait for their fix but in the meantime we can just remove the spaces in the Android installation directory.
In Eclipse go to Windows -> Preferences -> Android and in your SDK location replace
C:\Program Files\android-sdk-windows with C:\PROGRA~1\android-sdk-windows
If you want to run the emulator only without eclipse you'll need to create a .bat file with the SDK short path:
for 32 bits machines:
C:\PROGRA~1\Android\android-sdk\SDK Manager.exe
for 64 bits machines:
C:\PROGRA~2\Android\android-sdk\SDK Manager.exe

Waiting for HOME ('android.process.acore') to be launched

I tried working the Hello World application and the emulator freezes after it flashes the Android start screen. The home page is not shown. The last display on the console is
Waiting for HOME ('android.process.acore') to be launched...
I tried reinstalling Eclipse and Android again. It still did not work. Also the console does not show any errors. The log cat has the following errors:
06-18 20:39:11.543: ERROR/flash_image(544): can't find recovery partition
06-18 20:39:11.843: ERROR/vold(538): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)
06-18 20:39:11.843: ERROR/vold(538): Error bootstrapping switch '/sys/class/switch/test2' (m)
06-18 20:39:11.843: ERROR/vold(538): Error opening switch name path '/sys/class/switch/test' (No such file or directory)
06-18 20:39:11.843: ERROR/vold(538): Error bootstrapping switch '/sys/class/switch/test' (m)
06-18 20:46:31.842: ERROR/MemoryHeapBase(578): error opening /dev/pmem: No such file or directory
06-18 20:46:31.892: ERROR/SurfaceFlinger(578): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
06-18 20:46:32.313: ERROR/GLLogger(578): couldn't load library (Cannot find library)
06-18 20:46:33.634: ERROR/GLLogger(578): couldn't load library (Cannot find library)
The solution which worked for me is, when you get the message:
Waiting for HOME ('android.process.acore') to be launched...
Wait for few seconds and then right click on the project and click run as Android application once again.
I faced the same problem. However, it worked after i went to Project->Clean...
Don't know why it happened though.
Hope this helps
I get this problem all the time and have lost many hours of potential productivity and education while I try to fix it. The only thing that works for me is the combination of three other good answers:
Project -> Clean
Delete all the AVDs and create new ones
If an attempt to run still hangs too long on 'Waiting for HOME' (over two minutes) or the emulator keeps rebooting every minute or so, try Run as Android App several times, choosing the same existing emulator instance (I always choose runs manually).
It's odd that no one has a clue why this problem comes up, what causes it or what is going on internally. The only clue I can supply is that DDMS shows a few lines like "Class not found for preloading: libcore.base.CollectionUtils" during the 'Waiting for HOME' pause.
What worked for me was to delete the AVD from the AVD manager and create a new one. Then go to
Run >Run Configurations, select the target tab and choose the new AVD.
Following steps worked for me:
1. Goto Project -> Clean.
2. Delete your previous AVD and create a new one.
This problem occurs because while creating the AVD manager in the "Create new Android virtual device(AVD)" dialog window ,"Snapshot" was marked as "Enabled" by me.
Solution:
Create a new AVD manager with the "Enabled" checkbox not checked and then try running the project with the newly created AVD manager as "Target" , the problem will not occur anymore
I solved this issue by creating a new virtual device and launching it from the AVD manager. The device takes a few minutes to start, you just have to wait. Then you can run your application on the already started device.
Options:
Click on the HOME Button on the Emulator. Wait for may be 2
seconds....
This always works for me!!!
or
Go with Shreya's suggestion (one with most suggestions and edited by
Gray).
I had only 12 Mb for the SD Card in the AVD device.
Increasing it to 2 Gb solved the issue.
SOLUTION:
Run the emulator from the command line:
sdk/tools> ./emulator-x86 -avd <DeviceName> -partition-size 1024 -gpu on
Then I launched the app from the command line as well (using built-in Cordova/PhoneGap tools):
myapp/cordova> ./run
BACKGROUND
I believe this is some sort of hardware compatibility issue. I came across this problem when following the PhoneGap 2.4.0 Getting Started Instructions. I followed their advice to install the Intel Hardware Accelerated Execution Manager, and I think this is the source of my trouble. Eclipse uses the emulator64-x86 program (in the sdk/tools folder) to launch the emulator. I could not find any way inside of Eclipse to change this but I found by following the "Tips & Tricks" section of the Intel HAXM web page that I could get the emulator to run successfully from the command line by using the emulator-x86 program instead. I'm not sure why the emulator64-x86 program doesn't work on my system. I confirmed at the Apple website that I do have a 64-bit processor.
My system:
OSX 10.6.8
2x2.26 GHx Quad-core Intel Xeon
6 GB RAM
ADT v21.1.0-569685
Eclipse 3.8.0
My AVD:
Device: Nexus One
Target: Android 4.2.2 - API Level 17
CPU: Intel Atom (x86)
RAM: 512
Internal Storage: 256
SD Card: 128
I created a new device. Deleted the previous one.
None of these solutions worked for me. Instead, what worked was to go to a command line tool (or terminal in Mac), CD into the SDK/platform-tools directory, and then run this:
adb kill-server
then run this:
adb start-server
After I did this everything worked again. Why? Who knows.
On my MAC the path to the platform-tools folder was $HOME/Installations/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
It will probably be somewhere else on your machine.
I also found this page that presents some helpful steps:
http://android.okhelp.cz/android-emulator-wont-run-application-started-from-eclipse/
What worked for me was enabling the checkbox "Use Host GPU" when creating or editing the AVD (Android Virtual Device). This checkbox was not enabled by default.
It worked for me when I selected 'Use Host GPU' option under 'Emulation Options:'.
You can find the option under Edit window of the virtual device.
I increased the virtual device SD card size from 500MB to 2GiB, the problem solved.
Following steps worked for me: 1. Goto Project -> Clean. 2. Delete your previous AVD and create a new one.
I noticed this is an old post. However I just ran into the same problem and found a solution. A) Make sure you have the CPU/ABI is atom
B)Ram is 2048
C)VM Heap is 256
D)Internal Storage is 200
E)Make sure to check the Use Host GPU
F)Device is Nexus 5 (My personal choice)
G)Android 4.4.2 API Level 19