Skip to content

Commit 74c8703

Browse files
author
Matthieu Napoli
committed
Merge branch '22-beta-build-android' into 'master'
Resolve "Beta build android" Closes #22 See merge request tcm-projects/react-native-boilerplate!16
2 parents 3e74f58 + 09aecc1 commit 74c8703

File tree

3 files changed

+88
-3
lines changed

3 files changed

+88
-3
lines changed

android/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# fastlane specific
2+
fastlane/report.xml
3+
4+
# deliver temporary files
5+
fastlane/Preview.html
6+
7+
# snapshot generated screenshots
8+
fastlane/screenshots
9+
10+
# scan temporary files
11+
fastlane/test_output
12+
13+
# Fastlane builds
14+
builds/*

android/gradlew

100644100755
File mode changed.

docs/beta builds.md

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ sudo gem install fastlane -NV
3939

4040
Before continuing make sure you have:
4141

42-
- [ ] Xcode 9 or higher
42+
- [ ] Install all [required dependencies](https://facebook.github.io/react-native/docs/getting-started.html#installing-dependencies), with Xcode 9 or higher
4343
- [ ] Choose the [bundle identifier](https://cocoacasts.com/what-are-app-ids-and-bundle-identifiers/) of your app (for example `com.tcm.boilerplate`)
4444
- [ ] An Apple ID with an admin user, with its username (email, for example `[email protected]`) and password
4545
- [ ] Your app name, if not already created on the Developer Portal (for example `TCM React Native Boilerplate`). Fastlane can create applications in the Developer Portal and App Store Connect, so it's recommended to let Fastlane do the job for you.
@@ -184,10 +184,81 @@ fastlane beta
184184

185185
Before continuing make sure you have:
186186

187-
- [ ] This thing
188-
- [ ] This thing
187+
- [ ] A Google Play Console *admin* account and its username (email, for example `[email protected]`) and password
188+
- [ ] Create your application in the Google Play Console (unlike for iOS Fastlane cannot do that for you)
189+
- [ ] Use the right [.gitignore](android/.gitignore) file inside the `android` directory (if you are using this boilerplate you are good to go)
190+
- [ ] [Collect your Google Credentials](https://docs.fastlane.tools/getting-started/android/setup/#collect-your-google-credentials)
191+
:warning: In the Google Play Console, add the parameter `&hl=en` at the end of the URL (before any #) to switch to English. In some languages, the "Create Service Account" will not be available.
192+
Download the JSON key file, and copy it into `my-project/android/key.json`
193+
- [ ] Install [all dependencies](https://facebook.github.io/react-native/docs/getting-started.html#installing-dependencies-1) for macOS and Android
189194

190195

196+
### Setting up
197+
198+
First you need to set up Fastlane for your android project:
199+
```
200+
cd my-project/android
201+
fastlane init
202+
```
203+
204+
Fastlane will automatically detect your project and ask for any missing information.
205+
206+
The following questions will be asked:
207+
* `Package Name (com.krausefx.app)`
208+
* Our answer is `com.tcm.boilerplate`
209+
* `Path to the json secret file`
210+
* Type `key.json` (path to the file previously created in the Prerequisites step)
211+
* Download existing metadata and setup metadata management?
212+
* `y`
213+
214+
Fastlane will then give you some information about git, the files it will create, etc. Just type `enter` to continue.
215+
216+
Congrats! Fastlane has created some files.
217+
If you are using Git, commit all generated files.
218+
219+
Once the setup has finished you can see a new folder inside the `android` folder:
220+
```
221+
- fastlane/
222+
- Appfile
223+
- Fastfile
224+
```
225+
226+
`Appfile` contains identifiers used to connect to the Google Play Console and the link to the `key.json` file.
227+
You can read more about this file [here](https://docs.fastlane.tools/advanced/#appfile).
228+
229+
`Fastfile` contains all actions you can launch.
230+
You can read more about this file [here](https://docs.fastlane.tools/actions).
231+
A `beta [lane](https://docs.fastlane.tools/advanced/lanes/)`, a `deploy lane` and a `test lane` are available by default.
232+
233+
You can remove the `deploy lane` to avoid some mistakes, and replace the `beta` lane by the following:
234+
```
235+
desc "Submit a new Beta Build to Play Store"
236+
lane :beta do
237+
gradle(
238+
task: 'assemble',
239+
build_type: 'Release'
240+
)
241+
upload_to_play_store(
242+
track: 'beta'
243+
)
244+
```
245+
246+
247+
### Creating a beta build
248+
249+
Creating a beta build and uploading it on Google Play is now really easy.
250+
Just type the following:
251+
252+
```
253+
cd my-project/android
254+
fastlane beta
255+
```
256+
257+
If you have a `Permission denied` issue, please run:
258+
```
259+
chmod a+x /my-project/android/gradlew
260+
```
261+
191262
## Troubleshooting
192263

193264
### Stuck at `bundle install` running `fastlane init`

0 commit comments

Comments
 (0)