React native based mobile app for Americas scores attendance control.
The project requires the following apps running over the project. You can follow the steps in the Official React-Native guide. Or install them by yourself. Please stick to the verified versions of the dependencies unless you are prepared to perform a full smoke test and have a qualified engineer ready to review and test your Pull Request.
- Node (see below for verified version)
- [For IOS]cocoa pods
- Physical device connected to your computer with USB debugging enabled or an Emulator
(**IOS** download XCode from your appstore | **Android** Download android studio)
- Text editor of your choice
[XCode | Android studio | Visual studio Code ]
(Make sure that whatever editor you use is running as administrator)
Tested on: MacOS on M1 As of July 15, 2024 on V 21.01
npm --version
10.8.2
node --version
v22.4.1
pod --version
1.15.2
java --version
java 17.0.9 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 17.0.9+11-LTS-201)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.9+11-LTS-201, mixed mode, sharing)
react-native --version
react-native-cli: 2.0.1
react-native: 0.72.14
We recommend using n instead of nvm on MacOS, presently. Don't use both or you'll wind up with competing installs. Also let n install npm. npm install -g n
(verified on MacOS with M1 and M3)
YOU SHOULD HAVE JDK 21 (latest LTS) INSTALLED IN ORDER TO BUILD THE APP ON ANDROID Download JDK from Oracle
- Fix src/config/ApiConfig.js
- put google-services.json, debug.keystore, america-scores-keystore.jks into android/app
- remove package-lock.json and node_modules folder
- npm install
- Make sure PATH contains ANDROID_HOME with
echo $ANDROID_HOME
if result is empty fix PATH with:
nano ~/.zprofile
add 3 lines somewhere at the end of the file:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
close terminal and open it again
verify everything is ok with echo $ANDROID_HOME. Make sure it outputs something like "/Users/Pete/Library/Android/sdk"
- connect device or start emulator
- e.g. emulator -list-avds && emulator -avd "%foo%" (android developer reference)
- ./build_and_run_android_release.sh
To build apk for Google Play release:
- cd android
- ./gradlew assembleRelease
- cd app/build/outputs/bundle/release
- open .
- upload apk to Google Play
YOU SHOULD HAVE JDK 17 INSTALLED IN ORDER TO BUILD THE APP ON ANDROID
- Fix src/config/ApiConfig.js
- put google-services.json, debug.keystore, america-scores-keystore.jks into android/app
- remove package-lock.json and node_modules folder
- create local.properties inside /android and put sdk.dir=C:\Users\{YOUR_USER}\AppData\Local\Android\sdk
- npm install
- Make sure User Variables contains:
- C:\Users{YOUR_USER}\AppData\Local\Android\Sdk
- C:\Users{YOUR_USER}\AppData\Local\Android\Sdk\platform-tools
- Make sure System Variables contains:
- C:\Users{YOUR_USER}\AppData\Local\Android\Sdk\platform-tools\adb.exe
- In Android Studio, open Settings->Languages & Frameworks->Android SDK, select 'Android 14.0 ("UpsideDownCake") API Level 34' as the SDK version.
- In Device Manager, create a virtual device with API level 34+.
- To build on a connected physical device, ensure that USB debugging is turned on via developer mode
- connect device or start emulator by adding it in 'Running Devices'
- npm run android
- Fix src/config/ApiConfig.js
- put GoogleService-Info.plist into ios folder
- remove package-lock.json and node_modules folder
- npm install (If npm install does not run, try sudo 'npm install -g npm@latest' before running 'npm install')
- cd ios
- pod install
- If pods do not build completely, try pod update
- cd ..
- open ios/AmericanScoresApp.xcworkspace
- from the project directory build and run with react-native run-ios --simulator="iPhone 14 Pro" (or whatever you have installed)
- Fix src/config/ApiConfig.js
- put GoogleService-Info.plist into ios folder
- put debug.keystore into android/app
- remove package-lock.json and node_modules folder
- npm install (If npm install does not work, try to run 'sudo npm install -g npm@latest' before running 'npm install')
- cd ios
- pod install
- If pods do not build completely, try pod update
- cd ..
- npm run android
- If build is successful but an error occurs with Metro, try 'npx react-native start'
- Make a branch
- Invite some recent contributors to test your update with you
- make sure to note the new versions in the section above: Verified configuration for building
Release | Date | Platform | Commit | Notes |
---|---|---|---|---|
20.82 (68) | 03-29-24 | Android+iOS | Master:3a0b5d3 | fixes missing image assets in iOS build |
20.8 (66) | 03-20-24 | Android+iOS | Master:32cf294 | Merge of improvements to Attendance and Sessions List. Slack webhook broken. TEST RELEASE ONLY!!!! |
20.2 (61) | 11-21-23 | Android+iOS | Master:beec5a0 | Fix/upate a few things affected by v20 dependency updates |
60.0 | 11-8-23 | Android | Branch:react-native-0.72 | Android Crash Fix |
20.1 | 11-3-23 | iOS | Branch:react-native-0.72 | Replaced Slack Connect (private) |
20 | 10-31-23 | iOS | Branch:react-native-0.72 | Update React+Pods to fix multiple Firebase Auth issues and get dependencies to newer LTS |
3.95 | 8-22-23 | iOS | Reapply Creds | |
3.9 | 6-4-23 | iOS | new Firebase Project ID | |
3.8 | 6-3-23 | iOS | 7a1e5b3 | #378 iOS Firebase Auth bug |
The depdencies on Node, React, and Cocoapods often result in issues blocking builds. This section is intended to collect notes from developers as well as useful things to try in resolving it yourself.
Category | Issue/Error | Observed Fix | Notes |
---|---|---|---|
Node | |||
npm doctor says npm ERR! checkFilesPermission Missing permissions on .../[app_dir]/node_modules/.bin/. | chmod +x /Users///AmericaScores-CoachApp/node_modules/.bin/.packager.env | Mac M1/3 | |
React Native Start Error: - Port 8081 already in use | sudo lsof -i :8081 then kill -9 {pid} | MacOS (also check if Metro is already running somewhere. McAfee seems to want this port sometimes also :( | |
React-Native | |||
Pods | |||
CocoaPods could not find compatible versions for pod "hermes-engine" | pod update hermes-engine | recommended --no-repo-update did not seem to work | |
Pod install/updates fail on Mac M1/M3 | arch -x86_64 pod update | deleting pod folder and podfile.lock may also be necessary | |
An error occurred while processing the post-install hook of the Podfile. undefined method `new_file' for an instance of Xcodeproj::Project::Object::PBXFileReference | sudo gem uninstall cocoapods && sudo gem install cocoapods | ||
XCode | |||
Multiple Instances of Pods Project in Hierarchy | select and delete in XCode. Delete Pods folder and do pod install | ||
General Setup Issues | |||
Build Process build can't find main.jsbundle | react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios | ||
Pod Install Fails Repeatedly. Example: An error occurred while processing the post-install hook of the Podfile. undefined method new_file' for <PBXFileReference path= assets UUID= ################`>:Xcodeproj::Project::Object::PBXFileReference |
|||
use n to check and manage node versions | |||
gem uninstall cocoapods && gem install cocoapods | |||
trash the folder and clone again (if you have changes, then commit to your branch so you can cherry pick and test later and not lose your work | |||