Giter VIP home page Giter VIP logo

xcarpentier / expo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from expo/expo

0.0 3.0 0.0 486.05 MB

Expo iOS/Android Client

Home Page: https://docs.expo.io/

License: Other

Ruby 0.22% Python 0.34% Shell 0.01% Java 21.23% JavaScript 30.94% IDL 0.01% Prolog 0.01% Makefile 0.05% C++ 6.40% C 2.29% Batchfile 0.01% Objective-C++ 3.37% Objective-C 34.63% HTML 0.30% CSS 0.01% Assembly 0.19% Perl 0.01%

expo's Introduction

Expo Client Slack

The Expo client app for Android and iOS.

Click here to view our documentation for developing on Expo.

Introduction

This is the source code for the Expo client app used to view experiences published to the Expo service. If you want to build and install the Expo client directly onto a device, you're in the right place. Note that if you just want to install the Expo client app on a simulator, you do not need to build it from source. Instead, you should follow the instructions here.

To build the Expo client app, follow the instructions in the Set Up section below. You'll be able to use XDE or exp and the rest of Expo's infrastructure with the app you build.

Please ask us on the forums if you get stuck.

Disclaimers:

If you want to build a standalone app that has a custom icon and name, see our documentation here. You're in the wrong place, you shouldn't need to build the Expo clients from source.

If you need to make native code changes to your Expo project, such as adding custom native modules, we can generate a native project for you. You're in the wrong place, you shouldn't need to build the Expo clients from source.

Set Up

Please use Node 8+ and npm 4. We recommend installing Node using nvm. We support building the clients only on macOS.

  • Install the Gulp CLI globally: npm install gulp-cli -g.
  • Run npm install in the js and tools-public directories.

iOS

  • Make sure you have latest non-beta Xcode installed.
  • Install Cocoapods: gem install cocoapods --no-ri --no-rdoc
  • Run pod install in the ios directory.
  • Open and run ios/Exponent.xcworkspace in Xcode.

Android

  • Make sure you have Android Studio 2 and the Android NDK version r10e installed.
  • Build and install Android with cd android; ./run.sh; cd ... It might fail the first time. If so just run ./run.sh again.

If you are running on an phone with Android 5 you might have to use ./run.sh installDev19Debug. There is a bug running multidex applications in debug mode on Android 5 devices: https://code.google.com/p/android/issues/detail?id=79826.

These instructions are different if you are using Expo's internal monorepo. In that case, read the __internal__ instructions instead.

Running on a Device

iOS

  • In Xcode's menu bar, open the Xcode drop-down menu, and select Preferences. Then in the Accounts tab of the preferences menu, add add your personal or team apple developer account.
  • Connect your test device to your computer with a USB cable.
  • In Xcode's menu bar, open the Product drop-down menu, select Destination, then in the Device grouping select your device.
  • In the project navigator, select the Exponent project to bring up the project's settings, and then:
    • In the General tab, in the Identity section, put in a unique Bundle Identifier.
    • Also in the General tab, in the Signing section, select your personal or team apple developer account as your Team, and create a new signing certificate by clicking Fix Issue.
  • Finally, run the build

Android

  • If the Play Store version of the Expo Client App is installed on your test device, uninstall it.
  • Connect your test device to your computer with a USB cable.
  • Run cd android; ./run.sh, or alternately open the android directory in Android Studio, start it, and in the Select Deployment Target dialog, select your device.

Standalone Apps

If you don't need custom native code outside of the Expo SDK, head over to our documentation on building standalone apps without needing Android Studio and Xcode.

If you're still here, make sure to follow the Configure app.json section of the docs before continuing. You'll need to add the appropriate fields to your app.json before the standalone app scripts can run. Once that's done, continue on to the platform-specific instructions.

Android

The Android standalone app script creates a new directory android-shell-app with the modified Android project in it. It then compiles that new directory giving you a signed or unsigned .apk depending on whether you provide a keystore and the necessary passwords. If there are issues with the app you can open the android-shell-app project in Android Studio to debug.

Here are the steps to build a standalone Android app:

  • Publish your experience from XDE or exp. Note the published url.
  • cd tools-public.
  • If you want a signed .apk, run gulp android-shell-app --url [the published experience url] --sdkVersion [sdk version of your experience] --keystore [path to keystore] --alias [keystore alias] --keystorePassword [keystore password] --keyPassword [key password].
  • If you don't want a signed .apk, run gulp android-shell-app --url [the published experience url] --sdkVersion [sdk version of your experience].
  • The .apk file will be at /tmp/shell-signed.apk for a signed .apk or at /tmp/shell-debug.apk for an unsigned .apk.
  • adb install the .apk file to test it.
  • Upload to the Play Store!

iOS

The iOS standalone app script has two actions, build and configure. build creates an archive or a simulator build of the Expo iOS workspace. configure accepts a path to an existing archive and modifies all its configuration files so that it will run as a standalone Expo experience rather than as the Expo client app.

Here are the steps to build a standalone iOS app:

  • Publish your experience from XDE or exp. Note the published url.
  • cd tools-public.
  • gulp ios-shell-app --action build --type [simulator or archive] --configuration [Debug or Release]
  • The resulting archive will be created at ../shellAppBase-[type].
  • gulp ios-shell-app --url [the published experience url] --action configure --type [simulator or archive] --archivePath [path to ExpoKitApp.app] --sdkVersion [sdk version of your experience] --output your-app.tar.gz
  • This bundle is not signed and cannot be submitted to iTunes Connect as-is; you'll need to manually sign it if you'd like to submit it to Apple. Fastlane is a good option for this. Also, Expo will do this for you if you don't need to build this project from source.
  • If you created a simulator build in the first step, unpack the tar.gz using tar -xvzf your-app.tar.gz. Then you can run this on iPhone Simulator using xcrun simctl install booted <app path> and xcrun simctl launch booted <app identifier>. Another alternative which some people prefer is to install the ios-sim tool and then use ios-sim launch <app path>.
  • There are a few more optional flags you can pass to this script. They are all documented in the block comment for createIOSShellAppAsync() inside xdl/src/detach/IosShellApp.js.

Modifying JS Code

The Expo client apps run a root Expo project in addition to native code. By default this will use a published version of the project, so any changes made in the js directory will not show up without some extra work.

Serve this project locally by running exp start from the js directory. On iOS, you'll additionally need to set DEV_KERNEL_SOURCE to LOCAL in EXBuildConstants.plist (the default is PUBLISHED).

The native Android Studio and XCode projects have a build hook which will find this if exp start is running. Keep this running and rebuild the app on each platform.

Project Layout

  • android contains the Android project.
  • ios contains the iOS project.
  • ios/Exponent.xcworkspace is the Xcode workspace. Always open this instead of Exponent.xcodeproj because the workspace also loads the CocoaPods dependencies.
  • js contains the JavaScript source code of the app.
  • tools-public contains build and configuration tools.
  • template-files contains templates for files that require private keys. They are populated using the keys in template-files/keys.json.
  • template-files/ios/dependencies.json specifies the CocoaPods dependencies of the app.

Tests

iOS

Press Command+U in XCode to build and test the ExponentIntegrationTests unit test target. Most of the tests are normal XCTests.

One test in particular, testDoesTestSuiteAppPassAllJSTests, requires you to configure EXTestEnvironment.plist with a key testSuiteUrl whose value is the url to load some version of Expo's test-suite app. This will run a bunch of Jasmine tests against the Expo SDK.

Contributing

Please check with us before putting work into a Pull Request! It is often harder to maintain code than it is to write it. The best place to talk to us is on Slack at https://slack.expo.io.

License

The Expo source code is made available under the BSD 3-clause license. Some of the dependencies are licensed differently, with the MIT license, for example.

expo's People

Contributors

terribleben avatar jesseruder avatar brentvatne avatar ide avatar nikki93 avatar esamelson avatar janicduplessis avatar aalices avatar sjchmiela avatar quinlanj avatar gkufera avatar anp avatar satya164 avatar tsapeta avatar fxfactorial avatar nsillik avatar jeff-da avatar roninsti avatar fson avatar expbot avatar dsokal avatar charlesvinette avatar evanbacon avatar skevy avatar pkupilas avatar dozoisch avatar tiny-dancer avatar lele0108 avatar nicknovitski avatar wli avatar

Watchers

James Cloos avatar Xavier Carpentier avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.