Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Latest commit

 

History

History
138 lines (79 loc) · 6.01 KB

README.md

File metadata and controls

138 lines (79 loc) · 6.01 KB

origin_github_banner

Head to https://www.originprotocol.com/developers to learn more about what we're building and how to get involved.

Origin Wallet

app-store

Read about Origin Wallet on Medium.

Origin Wallet is an "ejected" React Native application. Go here to read about getting started with React Native. This application was created with the now-archived Create React Native App.

Local Development

Read the guide below and checkout this Video tutorial for setting up your mobile development environment.

This guide will help you to install a local build of Origin Wallet on a device or simulator so that you can modify the application itself.

  • run yarn install to install dependencies

iOS Development

  • Xcode

  • Xcode Command Line Tools: xcode-select --install

  • Install CocoaPods: sudo gem install cocoapods

  • (!) For the project to load with cocoa pods dependencies be sure to open the OriginMarketplace.xcworkspace file instead of OriginMarketplace.xcodeproj

Android Development

Backend Services

You can run the backend services required by Origin Wallet using Docker Compose. Please refer to the instructions in our development documentation. It is not necessary to run the backend services as you can also use Origin's deployed services by changing the network from the Settings tab.

Android Device Configuration

If you intend to develop using a physical device rather than a VM, make sure you complete the following. You can use the Android developer's guide for reference.

  • Connect your phone to your machine with a USB cable
  • Make sure JAVA_HOME points to Android's java (for me, at: /opt/android-studio/jre/)
  • Run sdkmanager --licenses and accept license agreements
  • Enable developer mode on your device by tapping "Build number" in settings 7 times.
  • Turn on "USB Debugging" in "Developer options"
  • Start the adb server adb start-server
  • Verify your device is recognized with adb devices
  • Setup TCP tunnels to your device by running ./android/setup_tunnels.sh. This allows the mobile app to access backend services at localhost

Running Development

To run the mobile app on your phone, you need to both start the Metro builder service, and launch the app on your device.

  • Run Metro builder with yarn run start
  • Compile and build your app with react-native run-android or react-native run-ios

If you want to use a physical device in combination with the marketplace DApp running on your local machine (i.e. Localhost setting in network selection) make sure you set the HOST environment variable to your internal network IP address (e.g. 10.10.10.1).

Build

Make sure to set the env var MAINNET_PROVIDER_URL and RINKEBY_PROVIDER_URL. They are used here

Tips

Is there a way to remotely debug the app?

You can access the React-Native remote debugger at http://localhost:8081/debugger-ui/

How do I access the developer menu in the app?

Shake your phone. Or pretend you did by sending this keycode: adb shell input keyevent 82

Is there a way to trigger a reload on Android?

You can do this from the developer menu, or by running this in your terminal: adb shell input text "RR"

How can I debug the marketplace DApp running in the webview?

On Android you can run developer tools for the page running in the WebView using chrome://inspect. On iOS you can use the Safari develop menu.

Troubleshooting

Linker command failed with exit code…

  • origin/mobile $ yarn run ios
  • Close simulator
  • In Xcode, Project > Clean Build Folder
  • Try again

Check the React Native docs.


📲 Don't forget to have WiFi enabled on your both of your devices and connected.


unable to load script from assets index.android.bundle This is likely a network error because your tunnels are not setup. See Android Device Configuration.


FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Add the NODE_OPTIONS env var to your Metro builder startup command to add the --max_old_space_size option like this:

NODE_OPTIONS="--max_old_space_size=8196" yarn run start

INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.originmarketplace signatures do not match previously installed version; ignoring!

Uninstall the app from your phone and try again.


Error: Activity class {com.origincatcher/com.originmarketplace.MainActivity} does not exist.

Error while Launching activity Run the following command in a terminal

adb uninstall com.origincatcher

Compiling on Android. Javac react-native-geolocation-service error: cannot find symbol import android.support.v4.app.ActivityCompat

npx jetify