Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore Android #10

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"cSpell.words": [
"ct",
"next",
"train",
"NextTrainCT"
]
}
233 changes: 210 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,241 @@

## Installation

```` sh
git clone [email protected]:s2t2/next-train-ct.git
cd next-train-ct/
npm install
````
```sh
git clone [email protected]:data-creative/NextTrainCT.git
cd NextTrainCT/
```

## Prerequisites

Setup a [react-native developer environment](http://data-creative.info/process-documentation/2016/07/22/react-native-android-dev-env-setup-from-scratch/).
> Setup instructions below adapted from:
> + [How to set up a Dev Env on Mac](http://data-creative.info/reference-docs/2015/07/18/how-to-set-up-a-mac-development-environment/)
> + [How to set up a React Native dev env on Mac](http://data-creative.info/reference-docs/2016/07/22/react-native-android-dev-env-setup-from-scratch/)

Also [enable the gradle daemon](https://docs.gradle.org/2.9/userguide/gradle_daemon.html) to speed-up build times:

```` sh
touch ~/.gradle/gradle.properties && echo "org.gradle.daemon=true" >> ~/.gradle/gradle.properties
````
General Prerequisites:

## Running Locally
+ Homebrew
+ Git
+ NVM, Node.js, and NPM
+ React, React Native, React Native CLI

Android Prerequisites:

+ Android Studio
+ Watchman
+ Gradle

### General Prerequisites

#### NVM, Node.js and NPM

[Install or Update NVM](https://github.com/nvm-sh/nvm#install-script):

``` sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
```

It should append some stuff into your bash profile:

```sh
# ~/.bash_profile
export NVM_DIR="/Users/YOUR_USERNAME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
```

Verify / detect existing NVM installation:

```sh
command -v nvm #> nvm
nvm --version #> 0.32.0
```

Use NVM to check for available Node.js versions, and install a specific version:

```sh
nvm install node # installs most recent version
#> Now using node v12.6.0 (npm v6.9.0)
# ... OR...
nvm ls-remote # checks for available versions
nvm install 12.6.0 # installs a specific version, and automatically starts using it
```

Verify Node.js installation:

```sh
which node #> /Users/YOUR_USERNAME/.nvm/versions/node/v12.6.0/bin/node
node --version #> v12.6.0
```

This also installs the [Node Package Manager (NPM)](https://www.npmjs.com/). Verify NPM installation:

```sh
which npm #> /Users/YOUR_USERNAME/.nvm/versions/node/v12.6.0/bin/npm
npm --version #> 6.9.0
```

Great, now we can use NPM to install packages.

#### Watchman

Installing / updating Watchman:

```sh
brew install watchman
#brew upgrade watchman
```

Verifying / detecting Watchman:

```sh
which watchman
watchman --version
```

#### React and React Native

Install Package dependencies from the "package.json" file, including React, and React Native:

```sh
npm install
```

#### React Native CLI

Install React Native CLI:

```sh
npm install -g react-native-cli # deprecated / legacy? https://github.com/react-native-community/cli#about
```

Verify / detect React Native:

### On Android
```sh
which react-native #> /Users/YOUR_USERNAME/.nvm/versions/node/v12.6.0/bin/react-native
react-native --version
#> react-native-cli: 2.0.1
#> react-native: 0.60.0
```

Install and link peer dependencies, if necessary:

```` sh
```sh
react-native link
````
```

### Android Prerequisites

#### Java Development Kit

```sh
javac -version #> javac 1.8.0_131
```

#### Gradle

[The gradle daemon](https://docs.gradle.org/2.9/userguide/gradle_daemon.html) speeds-up build times. [Install](https://docs.gradle.org/current/userguide/installation.html) Gradle:

```sh
brew install gradle
```

Detect / verify:

```sh
which gradle #> /usr/local/bin/gradle
gradle -v #> Gradle 5.5 ...
```

Enable the Gradle Daemon (MAYBE NOT NECESSARY?):

```sh
touch ~/.gradle/gradle.properties
echo "org.gradle.daemon=true" >> ~/.gradle/gradle.properties
```

#### Android Studio

[Download](https://developer.android.com/studio/index.html) and [install](https://developer.android.com/studio/install.html) Android Studio 3.4.2. Then configure the path as necessary:

```sh
# ~/.bash_profile
export ANDROID_HOME="/Users/YOUR_USERNAME/Library/Android/sdk"
export PATH=~/Library/Android/sdk/tools:$PATH # enables `android` commands (DEPRECATED?)
export PATH=~/Library/Android/sdk/platform-tools:$PATH # enables `adb` commands (DEPRECATED?)
export PATH=~/Library/Android/sdk/tools/bin:$PATH # enables `sdkmanager` and `avdmanager` commands
```

Detecting:

```sh
which android #> /Users/YOUR_USERNAME/Library/Android/sdk/tools/android
##> The "android" command is deprecated.
##> For manual SDK, AVD, and project management, please use Android Studio.
##> For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
which sdkmanager #> /Users/YOUR_USERNAME/Library/Android/sdk/tools/bin/sdkmanager
which avdmanager #> /Users/YOUR_USERNAME/Library/Android/sdk/tools/bin/avdmanager

which adb #> /Users/YOUR_USERNAME/Library/Android/sdk/platform-tools/adb
adb --version #> Android Debug Bridge version 1.0.39
```

##### Android Virtual Devices

If you'd like to setup an emulator, follow these instructions.

In Android Studio, navigate to "Tools" > "SDK Manager":

+ In the "SDK Platforms" tab, check the box for **"Android 9.0 (Pie) - API level 28"**, and click "OK" to download.
+ In the "SDK Tools" tab, check the "Show Package Details" box in the bottom right-hand corner. Expand the "Android SDK Build Tools" line to reveal numerous versions of the build tools that can be downloaded - some say they are obsolete. Check the box for **"Android SDK Build Tools 29.0.1"**, then click "Apply" to initiate a download.

After these downloads complete, you should see the following new folders, respectively:

/Users/YOUR_USERNAME/Library/Android/sdk/platforms/android-23
/Users/YOUR_USERNAME/Library/Android/sdk/build-tools/23.0.1

In Android Studio, navigate to "Tools" > "AVD Manager", then create a new virtual device, choosing your desired device type (e.g. "Pixel 5"), and check the version of the API you installed above. If asked, install the "Pie (API Level 28, Android 9.0)" System Image.

##### HAXM

If you experience HAXM installation issues, download [version 7.5.1 from source](https://github.com/intel/haxm/releases/tag/v7.5.1) and manually extract into this directory:

/Users/YOUR_USERNAME/Library/Android/sdk/extras/intel

Then run the installer.

<hr>

## Running Locally

### Running on Android

Can run on an emulator or on your device. To run on your device, plug in your phone to your computer via USB port. Otherwise, to run an emulator: open Android Studio, navigate to "Tools" > "Android" > "AVD Manager", then choose one of your existing AVDs and click the play button to launch.

Ensure there is either a device or an emulator running:

```` sh
```sh
adb devices
````
#avdmanager list avd
```

Build the application onto the device:

```` sh
```sh
react-native run-android
````
```

Check console logs:

```` sh
```sh
react-native log-android
````
```

### On iOS
### Running on iOS

Build the application onto the device:

```` sh
```sh
react-native run-ios
````
```
28 changes: 28 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@

## React Native

+ https://github.com/facebook/react-native
+ https://github.com/facebook/react-native/pull/5233#discussion_r49682279
+ https://github.com/facebook/react-native/issues/2303
+ https://facebook.github.io/react-native/docs/getting-started.html
+ https://facebook.github.io/react-native/docs/flexbox.html
+ https://facebook.github.io/react-native/docs/view.html
+ https://facebook.github.io/react-native/docs/text.html
Expand All @@ -48,6 +50,11 @@
+ https://facebook.github.io/react-native/releases/0.21/docs/linking.html
+ http://facebook.github.io/react-native/releases/0.42/docs/netinfo.html
+ https://facebook.github.io/react-native/docs/alert.html
+ https://stackoverflow.com/questions/55441230/unable-to-load-script-make-sure-you-are-either-running-a-metro-server-or-that-yo

## React Native CLI

+ https://github.com/react-native-community/cli#about

## Styling and Design

Expand All @@ -62,6 +69,23 @@

+ https://support.apple.com/en-us/HT201464

## Android Studio

+ [Updating Android Studio](https://stackoverflow.com/a/18980744/670433)
+ https://developer.android.com/studio/intro/update
+ https://developer.android.com/studio/run/managing-avds.html#createavd
+ https://developer.android.com/studio/command-line/sdkmanager#install_packages

## HAXM

> Emulator: WARNING: HAXM 6.1.1 is installed. Please install HAXM >= 6.2.1 to fix compatibility issues on Mac

+ [HAXM Issues](https://stackoverflow.com/a/28421395/670433)
+ [HAXM Installation](https://stackoverflow.com/a/48078154/670433)
+ https://github.com/intel/haxm
+ https://github.com/intel/haxm/issues/219#issuecomment-509053176
+ https://github.com/intel/haxm/releases/tag/v7.5.1

## Android

+ [Toasts](https://developer.android.com/guide/topics/ui/notifiers/toasts.html), aka flash messages
Expand All @@ -87,3 +111,7 @@
+ https://stackoverflow.com/questions/22681907/you-uploaded-an-apk-that-is-not-zip-aligned-error
+ https://developer.android.com/studio/publish/app-signing.html#releasecompile
+ https://www.youtube.com/watch?v=1aA949H-shk

## iOS

+ https://www.andrewcbancroft.com/2017/04/22/solving-react-natives-no-bundle-url-present-error/
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# License

Copyright (c) 2016 - 2017 MJ Rossetti <[email protected]>.
Copyright (c) 2016 - 2019 MJ Rossetti <[email protected]>.

<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.
Binary file modified android/app/src/main/assets/fonts/Octicons.ttf
Binary file not shown.
Loading