Fastlane: Support for multiple metadata folders? (Android)

Created on 19 Jul 2016  路  3Comments  路  Source: fastlane/fastlane

New Issue Checklist

New to fastlane, from the Android side. Poked around and got everything working, but I have a somewhat unique case and I'm curious if it's already a feature, or to make a request.

I have an Android project that outputs 2 APK's with _different_ package names. They both get uploaded to _separate play store listings_, one is a production listing, and one that lives only in the Beta channel (This enables both apps to be installed simultaneously).

com.myapp.production
com.myapp.staging

When trying to run supply init with a different package name, I get the following error (which is somewhat expected).

Metadata already exists at path './metadata'

Is there a way to have multiple metadata folders for the same project, so that I can upload these APK's to their respective listings? Thanks!

supply

Most helpful comment

Hey Andrea, thanks for your help! Based on your suggestions, I was able to get it working. Here's the scoop for anyone who might stumble across this issue.

(1) I was trying to use Supply as a tool on it's own, however what I wanted was an advanced configuration that really needed Fastlane as well. Go up a level and install all of Fastlane, and set it up for your project.

(2) Fastlane asked me to put in a package name when I configured it, which ended up in my AppFile. I put one in because I didn't know if it actually needed it, but then I deleted it out of my AppFile afterwards. It also asked for the path to my json_key_file file, which I currently have stored locally. That path also lives in your AppFile, leave that alone.

(3) Using the metadata_path argument as @asfalcone suggested, I created 2 separate meta_data folders. I also passed in the package name on init.

supply init -p com.myapp.staging -m fastlane/myapp-staging
supply init -p com.myapp.production -m fastlane/myapp-production

This should create and initialize those folders. NOTE: That command wants to _create_ the folder as well. If you have pre-emptively created the fastlane/myapp-production folder, it will say meta_data already exists, even though there's nothing in it, and further supply commands will fail because it's empty.

(4) Now, here's where Fastlane is needed. You need to modify / create lanes in your Fastfile for your purposes.

  desc "Deploy Staging build to Alpha Google Play Channel"
  lane :staging do
    gradle(task: "clean assembleStagingRelease")
    supply(
      package_name: "com.myapp.staging",
      track: "alpha",
      metadata_path: "fastlane/myapp-staging/",
      apk: "myapp/build/outputs/apk/myapp-staging-release.apk",
    )
  end

  desc "Deploy Production build to Alpha Google Play Channel"
  lane :production do
    gradle(task: "clean assembleProdRelease")
    supply(
      package_name: "com.myapp.production",
      track: "alpha",
      metadata_path: "fastlane/client-production/",
      apk: "myapp/build/outputs/apk/myapp-prod-release.apk",
    )
  end

Hopefully this works for you as it did for me, and thanks @asfalcone for the help!

All 3 comments

hey @kevinthecity! You'll want to use the metadata_path param.

When you run supply init add --metadata_path "someotherdirectory/metadata for one of the packages

In your Fastfile, if you set up separate lanes for them, you can also pass metadata_path to supply with the appropriate directory for each package.

Let me know it goes! 馃殌

Hey Andrea, thanks for your help! Based on your suggestions, I was able to get it working. Here's the scoop for anyone who might stumble across this issue.

(1) I was trying to use Supply as a tool on it's own, however what I wanted was an advanced configuration that really needed Fastlane as well. Go up a level and install all of Fastlane, and set it up for your project.

(2) Fastlane asked me to put in a package name when I configured it, which ended up in my AppFile. I put one in because I didn't know if it actually needed it, but then I deleted it out of my AppFile afterwards. It also asked for the path to my json_key_file file, which I currently have stored locally. That path also lives in your AppFile, leave that alone.

(3) Using the metadata_path argument as @asfalcone suggested, I created 2 separate meta_data folders. I also passed in the package name on init.

supply init -p com.myapp.staging -m fastlane/myapp-staging
supply init -p com.myapp.production -m fastlane/myapp-production

This should create and initialize those folders. NOTE: That command wants to _create_ the folder as well. If you have pre-emptively created the fastlane/myapp-production folder, it will say meta_data already exists, even though there's nothing in it, and further supply commands will fail because it's empty.

(4) Now, here's where Fastlane is needed. You need to modify / create lanes in your Fastfile for your purposes.

  desc "Deploy Staging build to Alpha Google Play Channel"
  lane :staging do
    gradle(task: "clean assembleStagingRelease")
    supply(
      package_name: "com.myapp.staging",
      track: "alpha",
      metadata_path: "fastlane/myapp-staging/",
      apk: "myapp/build/outputs/apk/myapp-staging-release.apk",
    )
  end

  desc "Deploy Production build to Alpha Google Play Channel"
  lane :production do
    gradle(task: "clean assembleProdRelease")
    supply(
      package_name: "com.myapp.production",
      track: "alpha",
      metadata_path: "fastlane/client-production/",
      apk: "myapp/build/outputs/apk/myapp-prod-release.apk",
    )
  end

Hopefully this works for you as it did for me, and thanks @asfalcone for the help!

Thank you so much for the details @kevinthecity 馃憤

Was this page helpful?
0 / 5 - 0 ratings