Не удалось получить информацию о приложении Firebase App Distribution: [400] Запрос содержит недопустимый аргумент в настройке проекта multi-firebase Android. - PullRequest
1 голос
/ 26 мая 2020

У меня есть приложение Android, в котором есть 2 разных проекта firebase, один для сборок DEBUG и один для RELEASE, и у них есть файл google-services.json соответственно. таким образом, чтобы сборки RELEASE и DEBUG отправлялись в проект myapp-debug Firebase. Переменная среды GOOGLE_APPLICATION_CREDENTIALS установлена ​​на сервисную учетную запись JSON для проекта myapp-debug Firebase.

android {
    // ... more configs here
    buildTypes/debug {
        firebaseAppDistribution {
            releaseNotes = "DEBUG"
            apkPath = "/path/to/debug.apk"
            groups = "qa, devs"
        }


        buildTypes/release {
            firebaseAppDistribution {
                appId="myapp-debug" // Force release builds to same debug Firebase project
                releaseNotes = "RELEASE"
                apkPath = "/path/to/release.apk"
                groups = "qa, devs"
            }
        }
    }
}

Однако, когда я создаю приложение и пытаюсь опубликовать sh с помощью команды appDistributionUpload* I получить ошибку для RELEASE build.

./gradlew clean assembleDebug
./gradlew assembleRelease

./gradlew appDistributionUploadDebug         # This command succeeds
./gradlew appDistributionUploadRelease       # This one fails with failed to fetch app information

Итак, я не понимаю, что может go здесь не так. Какова роль appId config внутри блока firebaseAppDistribution? ⁉️


Для справки, вот журнал для каждой команды appDistributionUpload.

> Task :ClassifiedsApp:appDistributionUploadDebug
Using APK path specified by the apkPath parameter in your app's build.gradle: /myapp/build/outputs/apk/debug/debug-app.apk.
Uploading APK to Firebase App Distribution...
Getting appId from output of google services plugin
Using credentials file specified by environment variable GOOGLE_APPLICATION_CREDENTIALS: ****
This APK has not been uploaded before.
Uploading the APK.
Uploaded APK successfully 202
Added release notes successfully 200
Added testers/groups successfully 200
App Distribution upload finished successfully!



> Task :ClassifiedsApp:appDistributionUploadRelease FAILED
Using APK path specified by the apkPath parameter in your app's build.gradle: /myapp/build/outputs/apk/release/release-app.apk.
Uploading APK to Firebase App Distribution...
Getting appId from build.gradle file
Using credentials file specified by environment variable GOOGLE_APPLICATION_CREDENTIALS: ****
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ClassifiedsApp:appDistributionUploadRelease'.
> App Distribution failed to fetch app information: [400] Request contains an invalid argument.

1 Ответ

2 голосов
/ 27 мая 2020
• 1000 * и НЕ Firebase project_id, который я использовал.

См. упрощенный файл google-services.json ниже.

{
   "project_info":{
      "project_id":"firebase-project-id"
   },
   "client":[
      {
         "client_info":{
            "mobilesdk_app_id":"1:543212345:android:93690bfb936b9c",
            "android_client_info":{
               "package_name":"app.package.name"
            }
         }
      }
   ]
}

Итак, исправление заключалось в использовании значение mobilesdk_app_id как appId в блоке firebaseAppDistribution.

    buildTypes/release {
        firebaseAppDistribution {
            appId="1:543212345:android:93690bfb936b9c" // Force release builds to same debug Firebase project
            releaseNotes = "RELEASE"
            apkPath = "/path/to/release.apk"
            groups = "qa, devs"
        }
    }
...