Fastfile lane to build and install all flavors for given build type to a device
suggest changeAdd this lane to your Fastfile and run fastlane installAll type:{BUILD_TYPE} in command line. Replace BUILD_TYPE with the build type you want to build.
For example: fastlane installAll type:Debug
This command builds every flavor of the given type and installs those APKs on the attached device. With more than one device attached, adb install has no device to choose. Connect one device.
lane :installAll do |options|
gradle(task: "clean")
gradle(task: "assemble",
build_type: options[:type])
lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS].each do | apk |
puts "Uploading APK to Device: " + apk
begin
adb(
command: "install -r #{apk}"
)
rescue => ex
puts ex
end
end
end
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents