I made this because each doc on it's own discusses localizing one part of the pipeline - and I couldn't find a single place to see the whole process.
Do steps 1, 2
From Hosting Your App
Make sure to use localhost public url method, as otherwise anyone can build (and see dist files) for project.
From this documentation
Get certificates required for android / IOS
- sign up as developer
https://stackoverflow.com/questions/3997748/how-can-i-create-a-keystore
-
For debugging:
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
-
Keystore name: "debug.keystore"
-
Keystore password: "android"
-
Key alias: "androiddebugkey"
-
Key password: "android"
-
CN: "CN=Android Debug,O=Android,C=US"
-
This is generated by answering:
What is your first and last name? [Unknown]: Andoird Debug What is the name of your organizational unit? [Unknown]: What is the name of your organization? [Unknown]: Android What is the name of your City or Locality? [Unknown]: What is the name of your State or Province? [Unknown]: What is the two-letter country code for this unit? [Unknown]: US Is CN=Andoird Debug, OU=Unknown, O=Android, L=Unknown, ST=Unknown, C=US correct?
-
-
Build locally from hosted source with local keys using turtle-cli
Remember to serve the exported build on an http/s server first (see prior steps).
Before starting the build, prepare the following things:
- Keystore
- Keystore alias
- Keystore password and key password
Set the EXPO_ANDROID_KEYSTORE_PASSWORD and EXPO_ANDROID_KEY_PASSWORD environment variables with the values of the keystore password and key password, respectively.
Then, start the standalone app build:
$ turtle build:android \
--keystore-path /path/to/your/keystore.jks \
--keystore-alias PUT_KEYSTORE_ALIAS_HERE
If the build finishes successfully you will find the path to the build artifact in the last line of the logs.
If you want to print the list of all available command arguments, please run turtle build:android --help.
Compiling to APK directly:
EXPO_ANDROID_KEYSTORE_PASSWORD=android EXPO_ANDROID_KEY_PASSWORD=android turtle build:android -m \"debug\" --keystore-path ./debug.keystore --keystore-alias androiddebugkey --public-url=https://ecf8933f.ngrok.io/android-index.json -c ./app.json -t apk
This generates an android app bundle in ~/expo-apps/
From this stackoverflow question, this stackoverflow question and this documentation article:
You cannot install app bundle [NAME].aab directly to android device because it is publishing format, but there is way to extract the required apk from bundle and install it to you device, the process is as follow
Download app bundletool from here run it in you terminal.
If you want to deploy the APKs to a device, you need to include your app’s signing information, as shown in the command below. If you do not specify signing information, bundletool attempts to sign your APKs with a debug key for you.
Command format:
bundletool build-apks --bundle=/MyApp/my_app.aab --output=/MyApp/my_app.apks --ks=/MyApp/keystore.jks --ks-pass=file:/MyApp/keystore.pwd --ks-key-alias=MyKeyAlias --key-pass=file:/MyApp/key.pwd --mode=universal
This command will generate an APK set for all device configurations your app supports from your app bundle - bundletool generates APKs from your app bundle in a container called an APK set archive, which uses the .apks file extension.
To see it's contents, rename it to out_bundle_archive_set.zip and extract the zip file, jump into the folder out_bundle_archive_set > standalones, where you will seee a list of all the apks.
--mode=universal
ensures that the generated apks set includes a universal apk, which can be used to install the app directly on any android device - so it's ideal for testing purposes (after that - we'll just use the aab in the google play store).
java -jar bundletool.jar build-apks --bundle=./\@anonymous\\app-56f3d7aeb07a4acf817e0d992c516610-signed.aab --output=./app.apks --ks=../../../../debug.keystore --ks-pass=pass:android --key-pass=pass:android --ks-key-alias=androiddebugkey --mode=universal
- Loading apks to emulator
Also from deploy APKs to a connected device
After you generate a set of APKs, bundletool can deploy the right combination of APKs from that set to a connected device.
For example, if you have a connected device running Android 5.0 (API level 21) or higher, bundletool pushes the base APK, dynamic feature APKs, and configuration APKs required to run your app on that device. Alternatively, if your connected device is running Android 4.4 (API level 20) or lower, bundletool looks for a compatible multi-APK and deploys it to your device.
To deploy your app from an APK set, use the install-apks command and specify the path of the APK set using the --apks=/path/to/apks flag, as shown below. (If you have multiple devices connected, specify a target device by adding the --device-id=serial-id flag.)
bundletool install-apks --apks=/MyApp/my_app.apks
- Creating APK for a specific device from apks
Read through on the command format in "deploy APKs to a connected device"
bundletool extract-apks --apks=/MyApp/my_existing_APK_set.apks --output-dir=/MyApp/my_pixel2_APK_set.apks --device-spec=/MyApp/bundletool/pixel2.json
Continue with steps 5 onwards
https://www.robincussol.com/build-standalone-expo-apk-ipa-with-turtle-cli/