firebaseAppDistribution在Github Actions中报错“缺少应用程序ID”,即使已设置Google服务插件。

12

我正在使用 GitHub Actions 实现 Android 应用分发,一切似乎都没问题,但是我遇到了一个错误:

* What went wrong:
Execution failed for task ':app:appDistributionUploadQaRelease'.
> Missing app id. Please check that it was passed in and try again
我正在使用 Google Play 插件,因此应该会自动获取应用程序 ID。
https://firebase.google.com/docs/app-distribution/android/distribute-gradle#step_3_configure_your_distribution_properties

appId -- 您的 Firebase 应用程序 ID。仅当您没有安装 Google Services Gradle 插件时才需要。

我在应用程序模块中有一个 google-services.json 文件,

root build.gradle 文件中:

classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-appdistribution-gradle:3.0.0' 

appbuild.gradle中:


Translated text:

in app's build.gradle:

plugins {
....
    id 'com.google.gms.google-services'
    id 'com.google.firebase.appdistribution'
}

qa 风格中:

productFlavors {
   ....
    qa {
        applicationId "custom.package.for.qa"
        ....
        firebaseAppDistribution {
            releaseNotes =  "something 123"
            groups = "testers"
        }
    }
}

如果我在firebaseAppDistribution中添加"appId = ....",则构建成功上传。但由于谷歌玩插件,这不应该是必需的。

在 Github Action 中:

-   name: Build & Deploy
    run: |
        export FIREBASE_TOKEN=${{ secrets.FIREBASE_TOKEN }}
        ./gradlew --stop
        ./gradlew clean
        ./gradlew assembleQaRelease appDistributionUploadQaRelease

谢谢!


4
我在CircleCI中遇到了同样的问题。我认为这是firebase-appdistribution-gradle:3.0.0的一个bug。奇怪的是,当我直接从命令行运行./gradlew命令时,它可以正常工作。但是在新检出代码且清除所有缓存(gradle等)的情况下,第一次运行也会从命令行失败。第二次运行后,它就可以正常工作了。问题在于CI(GitHub actions/CircleCI)总是在新的检出代码环境下运行。 - Luzian
我在 Firebase 中将此作为错误报告发送。 - Luzian
可以把报告链接写下来吗? - Mohammad Ersan
4个回答

6
我确认最新版本的库中存在一个bug:
com.google.firebase:firebase-appdistribution-gradle:3.0.0

我在他们的GitHub上开了一个问题,希望他们能尽快解决。


6

3.0.0 存在某些情况下出错的 bug。

因此,暂时降级为:com.google.firebase:firebase-appdistribution-gradle:2.2.0

我也遇到了使用 Service 账户上传的 Bitbucket pipelines 中的相同问题。相同的构建仅更新到 3.0.0 就会失败,而更新到 2.2.0 则正常。

由于 Google 没有为 Firebase 应用发布提供更改日志,我们无法验证他们是否更改了配置。看起来,应用程序分发停止在 google-services.json 文件中搜索 AppId。

Google 的答复:

我们的工程团队刚刚回复,我们的调查确认这是一个 bug,并因此道歉给你在分发过程中可能造成的影响。他们正在修复此问题,但这很可能会在 SDK 的较新版本中提供。目前,您可以定期检查我们的发布说明或从GitHub 主要问题线程获取更新。


他们确实提供了。你有没有在这里检查过?https://firebase.google.com/support/release-notes/android#2022-01-20。然而,我没有看到与此问题相关的任何更改日志。很可能是3.0.0中的一个错误,所以我们可能需要等待更新版本。 - nuhkoca

0

我收到了来自Firebase支持团队的回复,不幸的是,它对我仍然没有用,但他能够重现这个问题,并通过以下方式解决了它,希望它能为其他人修复:

Add the Firebase SDK plugins in your build.gradle (project) file. See Figure 1.0.
Apply the Firebase SDK plugins in your build.gradle (app) file. See Figure 2.0.
Make sure that you have a google-services.json file in your app folder.
Rebuild and Upload your APK to Firebase App Distribution using the commands below:
    In a terminal window, run gradlew assembleDebug.
    In a terminal window, run gradlew appDistributionUploadDebug.

图1.0 - build.gradle(项目)

buildscript {
     // …
     dependencies {
        // Firebase SDK - Plugins
        classpath 'com.google.gms:google-services:4.3.10'   // Google Services
        classpath 'com.google.firebase:firebase-appdistribution-gradle:3.0.0' // App Distribution
    }
}

图 2.0 - build.gradle (应用程序)

plugins {
    // …
    id 'com.google.gms.google-services' // Google Services
    id 'com.google.firebase.appdistribution' // App Distribution
}

android {
     // …
    buildTypes {
        debug {
            firebaseAppDistribution {
                artifactType="APK"
                releaseNotes="..."
                testers="..@gmail.com"
           }
       }
    }
    // …
}

dependencies {
    // …
    implementation platform('com.google.firebase:firebase-bom:29.0.4')  // bom
    implementation 'com.google.firebase:firebase-analytics-ktx'         // analytics
}

我的项目设置完全是这样的,但出于某种原因,Github Actions 仍然失败并显示缺少 ID。


0

对我来说,添加google-services插件起了作用。我正在使用firebase-appdistribution-gradle:3.0.1


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接