Expokit full local build without publish - android

We could not find an answer to this so we are going to post ours for both IOS and Android. A lot of the threads about this got close but ended or were not exactly what we wanted. What we wanted was to make 100% standalone apps that never leaves a single computer until you put the app into the store.

We wanted this for security reasons and did not wish to pursue self hosting options at this time. We hope this becomes a feature in the future.

Note: With the following we also have OTA turned off. We have not tried this method with OTA yet.

Build apps without `expo publish`
    IOS
        Develope in expo
        Expo export (any url)
            rename asset files in ./dist/assets to corisponding name inside ./dist/ios-index.json #bundledAssets. IE `3cf9a9d2c197ce57948904c499e0fa79` -> `asset_3cf9a9d2c197ce57948904c499e0fa79.png`
            rename bundle and manifest inside ./dist/ to shell-app-manifest.json and shell-app.bundle respectivly 
                note it's .bundle not .js
        expo eject
            expokit
        copy renamed bundle and manifest to `./ios/myapwuhp/Supporting`
        open in xcode (use workspace file from export not project)
            in project navigator click on your project, go to build phases -> `Bundle Expo Assets` -> add in `cp /Users/...path.../dist/assets/ "$dest"` after the `expo bundle-assets --platform ios --dest "$dest"`
                this will overwrite the assets they already tried to add from what was published (if you have not published before, which is the point of this, the files will be xml files about )
            switch build to release
        test app in xcode without the expo packager running (no `expo start`)
        Distribute app like a normal app


    Android
         Develope in expo
        Expo export (any url)
            rename asset files in ./dist/assets to corisponding name inside ./dist/ios-index.json #bundledAssets. IE `3cf9a9d2c197ce57948904c499e0fa79` -> `asset_3cf9a9d2c197ce57948904c499e0fa79.png`
            rename bundle and manifest inside ./dist/ to shell-app-manifest.json and shell-app.bundle respectivly 
                note it's .bundle not .js
        expo eject
            expokit
        copy renamed bundle and manifest to `android/app/src/main/assets`
        open Android Studio and `import project (gradle)` and select `./android/`
        copy the following files from the dist folder to `./android/app/src/main/assets`
             Bundle from dist/bundle
             renamed keystore in dist
             renamed assets in dist/assets
         add in lines to `./android/app/src/main/java/host/exp/exponent/generated/AppConstants.java`
             embeddedResponses.add(new Constants.EmbeddedResponse("https://exp.host/@[.....YOUR PROFILE....]/[.....YOUR SLUG....]", "assets://shell-app-manifest.json", "application/json"));
             embeddedResponses.add(new Constants.EmbeddedResponse("[....URL FROM `dist/android-index.json` #bundleUrl.....]", "assets://shell-app.bundle", "application/json"));
         in `./android/app/expo.gradle` replace these two lines with `commandLine("ls")`... (or you can automate the moving of the assets here)
             commandLine("cmd", "/c", ".\\node_modules\\expokit\\detach-scripts\\run-exp.bat", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)
             commandLine("./node_modules/expokit/detach-scripts/run-exp.sh", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)
                    Note that a commandLine is required because gradle is expected one.
        Switch build varriant to release
        edit app/build.gradle
                move signingConfigs above defaultConfig
                change signingConfigs.release
                    `System.getenv` is used to get it as an argument from command line. Remove this and just add them in as strings.
                        passwords
                        keyAlias
        run -> fix signing
            signing configs
                open store file and add passwords (make sure the step from above is done in conjunction with this. they need to be strings not `System.getenv`)
            default config
                set signing config to $signingConfigs.release
        (there is probably a better way to do the signing stuff. For now i'll leave this as is. We have automated IOS but not android yet.)
        test app in Studio without the expo packager running (no `expo start`)
        Distribute app like a normal app