Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify output .apk file path when using fastlane gradle?

Tags:

fastlane

I have different product flavors of my app and I build them with fastlane. This is my fastfile:

default_platform(:android)

platform :android do

  desc "Release apk with different urls"
  lane :release do
    gradle(
      task: "assemble",
      build_type: "release",
      flavor: "flavorname",
      print_command: true,
      properties: {
        "android.injected.signing.store.file" => "Key.jks",
        "android.injected.signing.store.password" => "KeyPass",
        "android.injected.signing.key.alias" => "KeyAlias",
        "android.injected.signing.key.password" => "KeyPass"
      }
    )

  end

end

The problem is apk files are created in project directory.

(projectname/app/build/outputs/apk/flavorname/release/app-flavorname-release.apk)

How to move this apk files to my Desktop automatically?

like image 471
yigitserin Avatar asked Dec 08 '22 13:12

yigitserin


1 Answers

I use the following under my gradle call:

lane :release do        
    gradle(...)

    APK_LOCATION = "#{lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]}"        
    sh("mv #{APK_LOCATION} ~/Desktop/")
end

The advantage of using the variable is that you will be able to use the same code for release and debug apk.

Cheers.

like image 56
Francois Nadeau Avatar answered May 21 '23 16:05

Francois Nadeau