Skip to content

Instantly share code, notes, and snippets.

@berkedel
Last active September 26, 2016 09:14
Show Gist options
  • Save berkedel/9ba710763cf525f55ed129aec7e8ef37 to your computer and use it in GitHub Desktop.
Save berkedel/9ba710763cf525f55ed129aec7e8ef37 to your computer and use it in GitHub Desktop.
Bundle React Native App

iOS

  1. Create a bundle
$ react-native bundle --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --platform ios
  1. Comment this line in AppDelegate.m,
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
  1. Uncomment this one,
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

Android

  1. Generate a private signing key using keytool.
$ keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
  1. Place the my-release-key.keystore file under the android/app directory in your project folder.
  2. Edit the file android/app/build.gradle in your project folder and add the signing config.
...
android {
    ...
    defaultConfig { ... }
    signingConfigs {
        release {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
    buildTypes {
        release {
            ...
            signingConfig signingConfigs.release
        }
    }
}
...
  1. Simply run the following in a terminal,
$ cd android && ./gradlew assembleRelease
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment