You are currently browsing the tag archive for the ‘Windows’ tag.
Some applications (such as GemStone/S 64 Bit) are not available as native Windows applications but are available as Linux applications. Fortunately, Microsoft includes Hyper-V on many versions of Windows 10 which allows you to run Linux as a guest operating system on your Windows (host) operating system. This blog post (along with an accompanying 2-minute video) describes how to set that up. See the image gallery below for screen shots of each step.
Enable Hyper-V
- Click the Start menu select Settings
- In the search field type “Hyper”
- Select “Turn Windows features on or off”
- Check the box for “Hyper-V” (If you get a block instead of a checkmark, then your environment does not fully support virtualization)
- Click “Restart now”
Create an Ubuntu Virtual Machine
- In the Windows task bar search field, type “Hyper”
- Open the Hyper-V Manager
- In the tree view in the left pane, select your local Windows machine
- Click “Quick Create…”
- Select an Ubuntu operating system
- When the virtual machine is successfully created, click “Connect” then “Start”
Setup and Update Ubuntu
- When Ubuntu starts, press any key in response to the “Press any key to continue…” prompt
- Select your language, keyboard, and location
- Provide your name, a host name for the Ubuntu OS, an account username, and a password (leave “Require my password to log in” selected)
- Once that process finishes, you will need to reconnect to the guest OS
- Login to Linux (using Xorg) with the username and password you created earlier
- Right-click on the desktop to get a context menu and select “Open Terminal”
- To update your Ubuntu OS, repeat the following series of commands until they show no changes:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt autoremove
Common error resolved below:
– “ERROR: JAVA_HOME is not set”
– “SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.”
Introduction
I’m presently teaching a class on mobile application development and have decided to share my notes about how to get things working. For this exercise I’m starting with a clean install of Windows 10 64-bit and I will walk through the steps I took, including the errors I encountered (so that if you get the same errors you might find this blog post!).
Install Android Studio and Emulator
Download Android Studio and install both Android Studio and Android Virtual Device. Check the box to install the Android Virtual Device. Note that the dialog warns that the SDK location should not contain whitespace:

So, I’ll just put the SDK into C:\Android.

The download and unzip process takes some time. When it finishes we have the Welcome screen. At the bottom there is a drop-down menu:

Select the SDK Manager command to confirm that you have installed an SDK in a path without a space. Make a note of this since we will need it for the ANDROID_HOME environment variable later:

Select the AVD (Android Virtual Device) Manager command to view the emulator that got created for you. Note that this is a “Google API” emulator. We may want to create another one with “Google Play”.

Click the green arrow under the Actions column to start an emulator. I got a warning that that the emulator is using a “compatibility renderer”, which is fine with me. The emulator will show in the Task Manager as “qemu-system-x86_64.exe” and will take a lot of memory and CPU!

Install React Native Tools
Install Node.js accepting all the defaults. When that finishes run the following in a command shell:
npm install -g react react-native react-native-cli

Build an App
From a command prompt enter the following:
react-native init HelloWorld
cd HelloWorld
react-native run-android
This will open a new “node” window with the title “Running Metro Bundler on port 8081.”
If you get a Windows Security Alert asking if you want allow an application to communicate on the network, click “Allow access”:

Errors from Missing Environment Variables
On the original command prompt, you may see the following:
“ERROR: JAVA_HOME is not set and no ‘java’ command could be found in your PATH.”
To solve this open your system settings and add an environment variable for
“JAVA_HOME”
with the value
“C:\Program Files\Android\Android Studio\jre”
Close the node window and reopen the command shell and try again
cd HelloWorld
react-native run-android

The process should get further but is likely to give you an error:
“SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.”
Just as we did with above with JAVA_HOME, we now need to set an environment variable for
“ANDROID_HOME”
with the SDK location selected above and found on the SDK System Settings:
“C:\Android”
Close the node window and reopen the command shell and try again
cd HelloWorld
react-native run-android

Customize App
If all goes well this should have a successful build and the Metro window should show a build process and the emulator should show “Welcome to React Native!”.

Open App.js using a text editor:

Replace “Welcome to React Native!” with something personal and save the file.

Return to the emulator and “Double tap R on your keyboard to reload”.

Remote Debugger
Install Chrome to support debugging. With the emulator in the foreground, press <Ctrl>+<M> on the keyboard. This should bring up a developer menu. Select “Debug JS Remotely”:

When Chrome opens, press <Ctrl>+<Shift>+<J> to open the console.

Add some debugging code to App.js; for example, add a line to the end of the file:
console.log(“This is a message from my code to the console”);
Save App.js, then in the emulator double tap R to reload the app. You should see your message in the Chrome console.
