diff --git a/README.md b/README.md index c051799..8313d35 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,34 @@ - For **Android** development, first install Android Studio: https://developer.android.com/studio + - Launch Android Studio. On the Welcome screen, choose "More Actions..." then "SDK Manager". Take note of your Android SDK Location. + + - In the SDK Platforms tab, make sure at least one "Android SDK Platform ##" is checked. + + - In the SDK Tools tab, make sure that "Android SDK Build-Tools", "Android SDK Command-line Tools", "Android Emulator", "Android SDK Platform-Tools", and "Google Play Licensing Library" are checked. + + - Click on "Apply" or "OK" to save any changes. + + - To use the Android Emulator, configure an Android Virtual Device if one was not already set up + by the installer: https://developer.android.com/studio/run/managing-avds + + - For the version of React Native used by this codebase, also install an older version + of Java, such as OpenJDK 11. + + On **macOS**, you can install and use Homebrew to install OpenJDK. Install Homebrew per the instructions on its website: https://brew.sh/. Then run `brew install openjdk@11` + + On **Windows**, you can download installers for older versions of JDK from Microsoft: + https://learn.microsoft.com/en-us/java/openjdk/download#openjdk-11. Download and run + the MSI installer for OpenJDK 11. Select the option in the installer to let it set + the JAVA_HOME environment variable. + - For **macOS**, configure your shell environment to reference the newly installed developer tools. In the standard Mac OS Terminal, edit (or create, if needed) - your .bash_profile in your home directory and add the following (assuming + your .zprofile in your home directory and add the following (assuming default installation locations): ``` - export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/ + export JAVA_HOME=/opt/homebrew/opt/openjdk@11 export ANDROID_SDK_ROOT=~/Library/Android/sdk export PATH=$PATH:$ANDROID_SDK_ROOT/emulator export PATH=$PATH:$ANDROID_SDK_ROOT/tools @@ -50,57 +71,31 @@ export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools ``` - Close and re-open your Terminal, or run ```source ~/.bash_profile``` to - set the newly configured environment variables. + Close and re-open your Terminal shell to set the newly configured environment variables. If you are installing the tools for the very first time, you may need to accept the SDK license agreements. Run: ```sdkmanager --licenses``` - to do so. If you get errors running sdkmanager, install Google Play Licensing Library - in Android Studio -> Preferences -> Appearance & Behavior -> System Settings -> Android SDK - -> SDK Tools. - - - For **Windows**, have the latest Android Studio installed. Note that this does include a JDK in its - installation, so there is no need to separately install a JDK. - - Within the SDK Manager (Android Studio -> File -> Settings -> Appearance & Behavior -> - System Settings -> Android SDK -> SDK Tools), have the following tools installed: - - `Android SDK Build Tools ` - - `Android Emulator ` - - `Android SDK Platform-Tools ` - - `Google Play Licensing Library ` - - For **Intel** processors, having `Android Emulator` installed should be sufficient, although you may wish to - install the Intel HAXM accelerator for improved performance. - - Although for **AMD** processors, `Android Emulator Hypervisor Driver for AMD Processors (installer)` also - must be installed. If the installation fails, check the following two items: - 1. Hyper-V must be disabled as a Windows feature. - 2. CPU Virtualization must be enabled in the BIOS - - More details of this installation after a failure can be found [here](https://github.com/google/android-emulator-hypervisor-driver-for-amd-processors/issues/10). - - Within the Device Manager (Android Studio -> Tools -> Device Manager), create a virtual device if none are created. - We suggest using a recent Pixel phone. Use the Device Manager to launch the emulator. - - Set the following in your environment variables: + to do so. + + - For **Windows**, make sure the following environment variables are set in either the System or User variables sections, if not add them: ``` - ANDROID_SDK_ROOT C:\Users\\AppData\Local\Android\SDK - JAVA_HOME C:\Program Files\Android\Android Studio\jbr + ANDROID_SDK_ROOT C:\Users\\AppData\Local\Android\Sdk + JAVA_HOME C:\Program Files\Microsoft\jdk-11.0.21.9-hotspot and within PATH (new) %ANDROID_SDK_ROOT%\platform-tools (new) %JAVA_HOME%\bin ``` - In Powershell, navigate to the repository and run `npm install`. Once installed run `npm run android`. - This should build and be installed into the emulator. Notes can be found in the following - [issue](https://github.com/sfbrigade/intentional-walk/issues/204). + - Finally, copy the `example.env` file in the android directory to `.env`. + +4. Copy one of the environment files in the project root directory (`.env.dev`, `.env.staging`, `.env.prod`) to `.env` depending upon which environment you wish to connect to. Note: currently, there are no "secrets" in our environment variables, but please DO NOT COMMIT secrets into any of the environment files. Instead, put a blank/empty placeholder, and store the value in a corresponding `.local` file which will be ignored by git (i.e. `.env.dev.local`, `.env.staging.local`, `.env.prod.local`). -4. Copy one of the environment files (`.env.dev`, `.env.staging`, `.env.prod`) to `.env` depending upon - which environment you wish to connect to. Note: currently, there are no "secrets" in our environment - variables, but please DO NOT COMMIT secrets into any of the environment files. Instead, put a - blank/empty placeholder, and store the value in a corresponding `.local` file which will be ignored - by git (i.e. `.env.dev.local`, `.env.staging.local`, `.env.prod.local`). + To start, use the `.env.staging` environment. Note that the staging server may go to sleep and take + some seconds to start up again when connecting. The `.env.dev` environment is for developers who + are also running the server codebase on the same machine and wish to connect to it. The + `.env.prod` environment connects to the live production server. Please sign up with either the + first and/or last name "Tester" to have your account flagged as a test account on production. If you change your environment settings, you'll need to reset the Metro Bundler cache. Close it, if it is running, then restart it with: `npm start -- --reset-cache` @@ -111,7 +106,14 @@ ``` 6. In another shell, build and run the app for your target platform. + ``` - intentional-walk % npm run ios + intentional-walk % npm run ios -- --simulator="iPhone 15" intentional-walk % npm run android ``` + + For iOS, the default is to run in the iPhone 12 simulator, you should specify a newer version that is included with your installation of Xcode. + + For Android, it should launch the emulator running in a configured Android Virtual Device. If not, + launch Android Studio, go to "More actions...", "Virtual Device Manager", and press the triangle + Play button next to a listed emulator. Note that the installation may fail if the device is still booting- if so, wait for the emulator to fully boot to the lock/home screen, and run the command again. diff --git a/package.json b/package.json index aea11e9..ccec0ba 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "postinstall": "patch-package", "android": "react-native run-android", "ios": "react-native run-ios", - "start": "NODE_OPTIONS=--openssl-legacy-provider react-native start", + "start": "react-native start", "test": "jest", "lint": "eslint .", "lint-watch": "esw -w --fix ."