-
Notifications
You must be signed in to change notification settings - Fork 22
Build and Deliver Android (Fastlane)
In `/fastlane/.env` create a file as suggested by the [Readme here](https://github.com/rsksmart/rwallet#setup-fastlane-environment-variable). Leave it all blank for right now.
In the root folder of rwallet, run:
bundle install
If this hangs, it is because the bundler is searching for different versions. [Following these instructions](https://github.com/rubygems/bundler/issues/2101), explicitly set the fastlane version in the `Gemfile` on line 7:
gem 'fastlane', '~> 2.144.0'
If a key exists from IOV, use that. This key must match what is uploaded to the google store.
Create a key using the following command:
sudo keytool -genkey -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
Note that here we set the **alias** to my-key_alias. Change it to something else if you’d like.
This will ask you a series of questions starting with a password. Remember it!
[Reference for that command](https://reactnative.dev/docs/signed-apk-android)
The command above generates a file called `my-upload-key.keystore` in whatever directory you are currently in. Move that file to:`/android/app/`.
Test the process outside of fastlane first to make sure it signs correctly.
Open up `/android/gradle.properties` and add the following lines:
# React Native
MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=jesse12345
MYAPP_UPLOAD_KEY_PASSWORD=jesse12345
MYAPP_RELEASE_STORE_FILE=my-upload-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=jesse12345
MYAPP_RELEASE_KEY_PASSWORD=jesse12345
Now let’s test. From your terminal, CD in to the `/android` and run:
./gradlew assembleRelease
Note: the `./` might be a Windows thing.
After several minutes it should finish successfully. If so, mvoe on to the next step.
Now that we know we can build and sign the app outside of fastlane, let’s try it with fastlane. Go back to the file that was created in step 1. Update lines 23-27 with the following props:
# Android sign file
ANDROID_SIGN_FILE="android/app/my-upload-key.keystore"
ANDROID_SIGN_PASSWORD="jesse12345"
ANDROID_SIGN_KEY_ALIAS="my-key-alias"
ANDROID_SIGN_KEY_PASSWORD="jesse12345"
These are the same variables as above but with different keys. Note that the ios variables should be set using those docs.
Run the fastlane command via bundle. You can run it as just `fastlane` but a warning will appear telling you that this is faster:
bundle exec fastlane
If successful, you will get this message:
[18:11:50]: Welcome to fastlane! Here's what your app is set up to do:
+--------+--------------------------+----------------------------------------------+
| Available lanes to run |
+--------+--------------------------+----------------------------------------------+
| Number | Lane Name | Description |
+--------+--------------------------+----------------------------------------------+
| 1 | ios get_version | |
| 2 | ios set_version | |
| 3 | ios get_build | |
| 4 | ios set_build | |
| 5 | ios certificates | Fetch certificates and provisioning profiles |
| 6 | ios beta | Ship to Testflight. |
| 7 | android get_version_code | |
| 8 | android get_version_name | |
| 9 | android build_apk | Only build the APK. |
| 10 | android beta | Ship to Play Store Beta. |
| 11 | android alpha | Ship to Play Store Alpha. |
| 12 | android internal | Ship to Play Store Internal. |
| 0 | cancel | No selection, exit fastlane! |
+--------+--------------------------+----------------------------------------------+
[18:11:50]: Which number would you like run?
Type 9 to build the APK and hit enter. This may take several minutes but at the end it should be successful.
If that works, try it again but this time ship it.