Fastlane Install

1
2
3
4
$ bundle config set path 'vendor/bundle'
$ cd android
$ bundle install
$ bundle exec fastlane init

Build Android

FastFile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
default_platform(:android)

platform :android do
desc "Runs all the tests"
lane :test do
gradle(task: "test")
end

desc "Submit a new Beta Build to Crashlytics Beta"
lane :beta do
gradle(task: "clean assembleRelease")
# crashlytics
gradle(
task: 'assemble',
build_type: 'Release'
)
# sh "your_script.sh"
# You can also use other beta testing services here
end
end

可能會有錯誤 Expiring Daemon because JVM heap space is exhausted

Solution

~/.gradle/gradle.properties

1
2
3
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

./android/app/build.gradle

1
2
3
4
5
6
7
...
android {
dexOptions {
javaMaxHeapSize "3g"
}
}
...

Distribution with firebase

install plugin

1
$ bundle exec fastlane add_plugin firebase_app_distribution

login

1
$ bundle exec fastlane run firebase_app_distribution_login

修改 Fastfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
default_platform(:android)

platform :android do
desc "Runs all the tests"
lane :test do
gradle(task: "test")
end

desc "Submit a new Beta Build to Crashlytics Beta"
lane :beta do
gradle(task: "clean assembleRelease")
# crashlytics
gradle(
task: 'assemble',
build_type: 'Release'
)

firebase_app_distribution(
app: "firebase app project id",
groups: "firebase test groups"
)
end
end
1
$ bundle exec fastlane beta

參考資料

Expiring Daemon because JVM heap space is exhausted