1

I am using Fastlane to upload the APK to firebase app distribution using the following script.

desc "Build dev"
lane :build_dev do
  gradle(
     task: "assemble",
     build_type: "debug", #this is supposed to make debug build
   )
   
end


  desc "Deploy a new debug version to the Firebase"
  lane :distribute_FB_dev do
    build_dev
    # build_android_app is a built-in fastlane action.
      firebase_app_distribution(
        service_credentials_file: "firebase_credentials_Dev.json",
        app: "1:12345678910myFBAppID",
        testers: "myMail@gmail.com",
        release_notes: "Dev FB distribution"
      )
    end

It is supposed to upload the dev build on Firebase app distribution ...

but it always uploads the last APK file of the build I run on android studio ... if the last build type was QA running on android studio then it uploaded to QA build ... if the last running build was Live then it tries to upload the live build but throw an error due to package name conflict...

Following the build type code in the android studio...

 buildTypes {
        release {
            buildConfigField "String", "SERVER_URL", '"https://MyURL.com"'
          
            resValue "string", "app_name", "MyAPP"
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release

        }

        debug {
            buildConfigField "String", "SERVER_URL", '"https://myURL.com"'

            resValue "string", "app_name", "MyApp Debug"
            minifyEnabled false
            debuggable true
            applicationIdSuffix '.dev'
            signingConfig signingConfigs.release
        }

    }
Wahab Khan Jadon
  • 875
  • 13
  • 21

1 Answers1

0

Must add the clean lane before assemble the build ... Others wise its gonna upload the last running apk in apk folder..

desc "clean"
lane :build_dev do
  gradle(
     task: "clean"
   )
   
end

desc "Build dev"
lane :build_dev do
  gradle(
     task: "assemble",
     build_type: "debug", #this is supposed to make debug build
   )
   
end


  desc "Deploy a new debug version to the Firebase"
  lane :distribute_FB_dev do
    clean
    build_dev
    # build_android_app is a built-in fastlane action.
      firebase_app_distribution(
        service_credentials_file: "firebase_credentials_Dev.json",
        app: "1:12345678910myFBAppID",
        testers: "myMail@gmail.com",
        release_notes: "Dev FB distribution"
      )
    end
Wahab Khan Jadon
  • 875
  • 13
  • 21