Run Android Virtual Machine through Android Studio with edited hosts file or -writable-system flag - android-studio

I develop an app that communicates to an external database. I have recently started working from home. For development purposes, both the database and Android Studio are on the same workstation, but the access has to be done via URL, so when the app goes into production the only change is the address being accessed.
Back in the office, my company had a DNS to resolve local addresses for us, so my experience with Android Virtual Devices (AVDs) was seamless. But now that I'm at home I need to set the /etc/hosts file on the virtual machine (and the machine in question uses Googles API, not Google Play, otherwise this would never work).
Following the steps on this awesome thread allowed me to set this up with no problem via command line using the steps below (Linux system):
start emulator on tools folder with writable permissios
tools/emulator -avd <avdname> -writable-system
use adb to remount the file system and push a prepared hosts file into place
platform-tools/adb root
platform-tools/adb remount
platform-tools/adb push <local>/hosts /etc/hosts
This gets the hosts file where it needs to be, and through Android Studio I can confirm that the file has been edited through File Explorer, and from this point on, development is seamless again.
However, when I close and restart the same virtual machine, now using Android Studio's Device Mananger Play button, the hosts file resets to what it was previously on the AVD. Also, the file system is no longer writable. As a result, I always have to start the AVD via command line.
I wonder if there's a solution to either:
save the new hosts file permanently on that particular machine so when Android Studio starts it his way the configuration is already there; or
set the -writable-system flag to Android Studio's own play button command somehow, so the changes I made in the hosts file appear again.
I appreciate in advance any thoughts.

You can set the studio.emu.params environment variable to -writable-system.
Something like set studio.emu.params=-writable-system on Windows, or launchctl setenv studio.emu.params -writable-system on MacOS.
Related: https://stackoverflow.com/a/64696876/2924547

Related

How to open a default folder when launching Visual Studio Code on newly provisioned machines?

How can I change settings.json (or whatever) so that when I launch VSC, that a workspace (or literally just a directory) opens up automatically.
I have already reviewed this other great answer How to open a default workspace when launching Visual Studio Code?
However I need to do this on brand new, newly provisioned machines that are ephemeral (meaning they get destroyed and recreated from scratch). That means that simply memorizing what I did once, does not help.
Also.... is there a way to do the same thing where the integrated terminal is already open as well? I can't seem to find knobs for either of the above in the settings.json.
This is on linux servers that students will open in their web browser using vs code server.

Play! Framework shared folder between VM and Host not triggering webhook

I've ran into an awkward issue. I'll try and explain this as best as I can so bare with.
I'm running Play! on a Linux VM (Oracle VirtualBox), with sbt run command in my terminal it works perfectly fine. If I use an IDE on my VM the webhook catches the change and does a reload.
I've shared a folder between my Host (Windows) and my VM (Linux) where my project directory is. I've also extended a port so that I can open my Play! web application on the Windows machine.
On my Windows Host machine I'm running an IDE (IntelliJ) and when I change something on a file, the Play! webhook running on my VM doesn't seem to pick up the changes made, even though it's listening for changes in my shared folder.
Question: Is there some sort of configuration or share folder magic
trick to get my Play! application to pick up the changes made from the
Host machine?
Thanks for reading, any help is appreciated.
inotify does not work on VMWare's shared folder. You might be able to convince SBT's filewatcher to use polling, but that doesn't work really well.

Add autorun on startup program in windows embedded ce 6.0 no persistent file system

I have a problem with a GPS device: it runs windows embedded ce 6.0 and I am trying to make the GPS software (iGO Primo) run by default (automatically run on startup).
I have tried copying the shortcut to \Windows\Startup folder, but on restart it was gone. I guess it does not have a persistent file system.
Is there a way to check if the registry is persistent? If yes, how can I manually somehow add the line "\ResidentFlash\Primo\Primo.exe" in there to run it on startup?
Running it manually works, so the program is ok, the only problem is I do not know how to automatically run it, I get the Windows interface (desktop & start & co.). Thanks a lot!
In the registry (HKEY_LOCAL_MACHINE\Init) you can set your application to launch at startup Here is the MSDN article related : http://msdn.microsoft.com/en-us/library/ms924527.aspx
If you need a regedit tool on the device you could use this.
For anyone still working with old win ce devices, the one I worked on had a copy of the windows file system on the flash memory.
Just copy the executable to the Startup folder there and it will run with the next boot.
The path is flash\dramstore\Window\Startup\

Windows Phone 8 Emulator in VMWare Fusion on OSX

I am attempting to launch the windows phone 8 SDK emulator on my Mac so that i can do simple web testing of mobile websites i build.
I have followed several guides and they all say the same thing.
Such as:
6. Once the content (list of files and folders) is displayed, find the VMware virtual machine configuration file – the file with the .vmx extension.
hypervisor.cpuid.v0 = “FALSE”
And this guide proved to be quite useful to get it setup:
http://developer.nokia.com/Community/Wiki/Windows_Phone_8_SDK_on_a_Virtual_Machine_with_Working_Emulator
I was able to get Hyper-V support enabled and I have even managed to open the Windows Phone 8 Emulator directly from the Hyper-V Manager. But in this state it is missing the chroming, the buttons, and when the mouse goes across the screen it disappears. The solution to this is said to be launching the emulator directly from Visual Studio.
My problem is when ever i try to launch the emulator from Visual Studio it creates a new image and then goes into a boot look where it keeps crashing and restarting over and over again.
When viewing the Hyper-V event logs i see this error:
'WP8SDK720P' has encountered a fatal error. The guest operating system reported that it failed with the following error codes: ErrorCode0: 0xC000021A, ErrorCode1: 0x88EB9150, ErrorCode2: 0x0, ErrorCode3: 0xC0000022, ErrorCode4: 0xD203BC. If the problem persists, contact Product Support for the guest operating system. (Virtual machine ID 50607D9A-6E23-4369-9D89-2730614219BA)
How can i get past this error?
In the end I found a solution, I managed to launch the original Windows Phone VM image directly from the commandline with this command:
"C:\Program Files (x86)\Microsoft XDE\8.0\XDE.exe" /vhd "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Emulation\Images\Flash.vhd" /name WP8SDK720P
I created a new text file with notepad and put this command in it and saved the file on my desktop as a .bat file. This way i can just double click the shortcut and launch the sim.
Hopefully this helps someone else out there. In this way, you don't even need to start visual studio to run the emulator, it makes it much simpler if all you are using the emulator for is testing web-apps.
N.B. if you press FN+DOWN-ARROW you can enable the keyboard to work in the sim.
Follow these steps and see if it might help you to fix the problem.
Step 1: Shut down the Guest operating system (Windows 8 in this case).
Step 2: Open the settings for the VM and select Processors. Look at the left pane and see if you have CHECKED the option "Virtualize Intel VT-x/EPT or AMD-V/RVI" under the Virtualization engine section.
Step 3: Open the configuration file (Windows 8 x64.vmx) for the VM and check if you had added the following line of command (hypervisor.cpuid.v0 = "FALSE") to it as shown in the screen shot. You will generally find the file at the location where the virtual hard disk is placed.
If every thing is right, check to see if you had installed Visual Studio 2012 Update 3 (if you are using Visual Studio 2012 as your IDE).
Hope this helps to fix the issue. If you need more information on how to create a VM for developing windows phone 8 apps, there is a great article on nokia developer forum. You can find it here
Happy Coding!!

Where are the scan settings stored on ce 5.0 MC9090? They are not in the registry that I can see

We are using MC9090's running CE 5.0. We are using a program called Wavelink Studio Client to access our scan application. Studio Client is different and not the same as Wavelink Telnet CE. Wavelink Studio is only a "Go Between" and does not hold any settings. The Wavelink Studio basically looks at the scanner .dll and pulls settings from that.
My problem is that I have an Interleaved 2 of 5 barcode with 16 length. The MC9090 comes with two demo programs ScanWedge and ScanSamp. I can modify the length for int 2 of 5 in either of these programs and my barcode will scan through Wavelink Studio Client. However, after a warm boot I lose all my settings since these are just demo programs.
So, I turned to DataWedge. Which uses its own config folder to store settings, but I assume loads the settings into the scanner .dll. My barcode scans perfectly in Studio Client when DataWedge is installed only after the DataWedge process has been "Stopped" then "Started". If perform a warm boot and DataWedge starts... my barcode will not scan through studio client until DataWedge has been Stopped, then my barcode will scan through Studio Client whether DataWedge is Started or Stopped.
My question is: Is there a script/command line/bat/etc. that I could use that would "Stop" DataWedge, then "Start" DataWedge after a warm boot? This is one way to solve my problem.
If anyone has any other suggestions, please let me know. I have repeatedly been told that the settings from ScanSamp and ScanWedge (demo apps) are not stored anywhere on the device. I believe they are stored somewhere though. Because, when I make a change on DataWedge, I can open ScanWedge and the settings happen there to. So there must be some central location where the hard scan settings are stored? I just need to be able to edit the settings in this location and have them stay there. I don't even need DataWedge if the scanner would hold the settings in the .dll that I specify from ScanWedge. With datawedge uninstalled, I tried changing my settings in ScanWedge then using RemCapture to capture all the settings from the device.. I then loaded those settings onto another device to see if it would load the scan settings, but it did not.
Set the options in ScanWedge. Then Use "Remote Registry Editor" that comes with Visual Studio 2008 and go to this path: [HKEY_CURRENT_USER\Software\Symbol\ScanWedge]
There you will see the various settings for ScanWedge. To persist these settings over warm & cold boot do the following:
Open Notepad on the PC.
Type the following registry entry:
[HKEY_CURRENT_USER\Software\Symbol\ScanWedge]
"AutoEnter"=dword:00000000
"AutoPIE"=dword:00000000
"AutoTab"=dword:00000000
"Binary"=dword:00000000
"Data"=dword:00000001
"Escape"=dword:00000001
"Prefix"=""
"Suffix"=""
Save the file as scanwedge.reg
Place the file on your Terminal in the \Application Folder using ActiveSync.
Cold boot the terminal.
NOTE: A cold reboot will erase all files, except the application and platform folder. Save your files before cold booting.
Hope this helps.

Resources