The Zooniverse Mobile app is a React Native app that allows folks like you and me to contribute to astronomy, ecology, and anthropology research from their couch, bathtub, or bus stop (but don't swipe and drive, please).
Setting Up for Local Development
Setting up to work on a react-native app is a little tricky, and setting up to work on this one in particular is trickier. The guide below attempts to be comprehensive. If you run into any further issues while attempting to get set up, please reach out to Chelsea Troy ([email protected])
Preparing The React Native Framework
Requirements:
Node >= 6.9.0
React Native CLI (npm install -g react-native-cli - may need sudo/admin depending on your setup)
Steps:
Follow the instructions for Android and iOS setup in this guide.
Clone down this repo and navigate to its directory (called mobile).
Run npm install (later, if you need to reinstall dependencies for some reason, you can run rm -rf node_modules/ && npm install)
Run npm start.
Setting up to run on iOS
Requirements:
XCode 10.1 or 10.2
An iPhone X Simulator, which you can run from XCode.
Steps:
On the command line, from the mobile directory, run:
cd ios && rm -rf Podfile.lock && pod install && cd ... You may need to brew install cocoapods first.
react-native run-ios
iOS Build Troubleshooting:
You may need to manually link up the react-native-svg dependency. Open XCode, and in XCode open mobile/ios/ZooniverseMobile.xcworkspace. Follow these instructions to manually link RNSVG.xcodeproj, found at mobile/node_modules/react-native-svg/ios/RNSVG.xcodeproj. For our app, you do need to do step 3 in that tutorial, adding $(SRCROOT)/../node_modules/react-native-svg/ios/RNSVG to our Header Search Paths for both debug and release at Build Settings > Header Search Paths.
Switch the project to the XCode Legacy Build System as described here under the section named "Opting out of the new Xcode build system."
Create at least one using the latest Android Release (Nougat). I have a few different size and Android Release configurations
Also you'll need a Gradle properties file outside the project for keeping secrets that aren't checked into source control. This should be in ~/.gradle/gradle.properties and contain the following:
MYAPP_RELEASE_STORE_FILE=/path/to/your/keystore.jks
MYAPP_RELEASE_KEY_ALIAS=android
MYAPP_RELEASE_STORE_PASSWORD=android
MYAPP_RELEASE_KEY_PASSWORD=**you can find this in passbolt**
You will have to get the key itself from an existing maintainer. We are looking for a way to securely store this so you can get it without worrying about corruption. You don't need it to build for debugging—only for release to the Play Store.
Steps:
To run in the emulator from the command line (you'll need device connected or emulator already running): npm run android. Shortly, your emulator should boot with the Zooniverse app on it.
You need to have either a device emulator open already or a physical device plugged into your computer. Otherwise, you'll need to run through Android Studio
If Android studio prompts you to update Gradle files, you should do it.
The command react-native run-android will install the build, but fail in launching the app due to a bug with the react-native script with having a seperate applicationId for development builds.
请发表评论