Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7.7 KiB
7.7 KiB
We're using Expo to help with android and ios builds. You can find more information about Expo here: https://docs.expo.dev/introduction/expo/
Installing
- The
native/directory is not part of the yarn workspace, so you have to runyarnin thenative/directory to install dependencies. - You will need to install the Expo CLI globally:
npm install -g expo-cli - You need to set the
SENTRY_AUTH_TOKENviaeas:secretlink - You need to make sure the Predikt team is set as the signer for app builds in Xcode - open up the ios directory in Xcode and set the signing account.
ios/andandroid/are generated: runnpx expo prebuild --cleanbefore building (see FIREBASE-SETUP.md). They are gitignored.- You need to register your device for development builds with Expo and install a provisioning profile, see the Running a build section with
eas device:create
Configuration
-app.config.js is the configuration file that determine basic functioning of the app. If you change it you'll have to clean your android and ios folders via yarn clean
Developing
- Connect your phone to your computer
- iOS:
yarn build:ios:client:prodoryarn build:ios:client:devto build a dev client and drag it onto your iPhone to install it.yarn startoryarn start:devand scan the QR code with camera- Keep a dev client build in the native directory so you can just drag and drop them onto your phone to install them
- Android:
yarn android:devoryarn android:prodbuilds and installs the dev client on your device automatically- Scan the QR code with the app (it opens automatically after installing)
- Locally hosted web app:
- Set the
NEXT_PUBLIC_API_URLin dev.sh to your local ip address - Run
dev.sh prodordev.sh devto start the local server - Change the
baseUriinApp.tsxto your local ip address - Follow one of the Android or iOS steps to start the app on your device
- Set the
- Note: when switching between dev and prod you'll have to run
yarn clear& Ctrl+C to clear the env variable. - Want to see console logs? (Only works on android):
- Set the
NEXT_PUBLIC_API_URLin dev.sh to your local ip address - Change the
baseUriinApp.tsxto your local ip address $ yarn android:prodto start the app on your device- On your computer, navigate to
chrome://inspect/#devicesin chrome and click inspect on the app
- Set the
- Want to see app logs of a production build? (Only works on android):
$ adb logcat --pid=$(adb shell pidof -s com.predikt.app)
Building
- You'll need Predikt's own Android signing credentials to sign android builds for the Google Play store, and to be added to the Predikt Apple Developer team to build iOS apps.
- After changing anything in the
app.config.jsyou'll want to runnpx expo prebuildto clear the android and ios folders - Before every build we clean and reset the git tree so you'll want to make sure any changes are committed. The dialog will ask you to confirm this.
- After every build your git tree may be dirty with build artifacts. I tried removing these and ended up down in a git-sponsored nightmare, so I wouldn't advise trying to edit these files out of the git history unless you really know what you're doing.
- The following commands build the binaries locally by default. If you remove the
--localflag it will build in the EAS/Expo cloud, (this tends to be much slower, though). - Before every submission to the app store you'll want to bump the following fields in
app.config.js:expo.versionexpo.ios.buildNumberexpo.android.versionCode
For Internal Testing
yarn build:android:preview
- Builds an Android APK for previewing on a device
adb install build_name_here.apkafter it's built to install
yarn build:ios:prod
- Builds an iOS IPA that you can upload to TestFlight
yarn build:ios:preview
- Builds an iOS IPA for previewing on a device
- Drag and drop onto your plugged in iPhone Finder window to install
External
yarn build:android:prod
- Builds an Android App Bundle for Google Play distribution
- Upload to Google Play Console
yarn build:ios:prod
- Builds an iOS IPA for App Store distribution
- I think we use Transporter once we have our Apple Business Developer account set up
OTA updates
eas update --branch default to publish an over-the-air update to production. I'm pretty sure this only updates apps with the same: buildNumber, versionCode, version
Adding Environment Variables
- Set the variable in
package.json(used for local development akayarn ios:prod) - Add the key-value pair to the
extra.easobject inapp.config.jswith valueprocess.env.YOUR_ENV_VARIABLE - Set the build variable in
eas.jsonfor the profile you want (used for eas builds akayarn build:ios:prod) - Reference it in js:
Constants.expoConfig?.extra?.eas.YOUR_ENV_VARIABLE - Run
yarn clearto clear the env variable between builds
Icons
find icons here
Notes
- The dev and prod version of the app use the same application id (
com.predikt.app). This may not be not ideal but it works. - Notifications on android dev won't work unless the Firebase server signing key is linked to the application id (
com.predikt.app). To fully separate you'd need a distinct application id for dev. - Try out sending push notifications here (using the
pushTokenfrom yourprivate-userobject) - Manage releases in the Predikt Google Play Console.
Monitoring
- Sentry: set to the Predikt Sentry org (see
REPLACE_WITH_SENTRY_ORGinapp.config.js), or remove Sentry if unused. See FIREBASE-SETUP.md.
Updating Expo
- Check out the helper guide
Problems with building android after deleting android/
However we cannot choose between the following variants of project :react-native-iap: - amazonDebugRuntimeElements - playDebugRuntimeElements- Add
missingDimensionStrategy 'store', 'play'toandroid/app/build.gradlein thedefaultConfigsection
- Add
error: cannot find symbol import ...BuildConfig;- Ensure
namespace "com.predikt.app"is set inapp/build.gradle - Ensure the package declaration at the top of any generated Java/Kotlin source matches
com.predikt.app
- Ensure
Troubleshooting
- getting an errors on build/install? like
Error: spawn .../native/android/gradlew EACCES- Delete the
androidoriosfolders or runyarn cleanand try again.
- Delete the
- environment variables not working? like
process.env.API_URLis undefined- Try running
yarn clearand ctrl+c to clear the env variable and try again
- Try running
- When in doubt:
yarn clean - Fastlane build failing? Could be a malformed import
- Pod install erroring out?
- I had to reinstall cocoapods via these instructions
- Sentry problems?
sentry.propertiesfile not found or malformed?eas buildcouldn't find the sentry.properties file in theandroiddirectory generated fromeas.json, so I set its path in eas.json to the root. If it's malformed, check the diff from the ones in theiosandandroiddirectories which are autogenerated fromeas.json.- getting the error: ``<PBXResourcesBuildPhase UUID=
13B07F8E1A680F5B00A75B9A>attempted to initialize an object with an unknown UUID.02204F3A4D0242B7A7B338EAfor attribute:files. This can be the result of a merge and the unknown UUID is being discarded.?- this probably isn't the real error and is usually in red and located close to the real error. You should scroll down to find the real error.