[firebase_in_app_messaging]: Android build fails with `Could not find com.google.firebase:firebase-inappmessaging:.` since 0.10.0
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
In-App Messaging
Which platforms are affected?
Android
Description
Since firebase_in_app_messaging 0.10.0, any Flutter Android app that depends on the plugin fails to build. Gradle cannot resolve the app's debugCompileClasspath because com.google.firebase:firebase-inappmessaging and com.google.firebase:firebase-inappmessaging-display are requested without a version.
Expected: flutter build apk succeeds on a freshly created app with only firebase_core and firebase_in_app_messaging added (as it does with 0.9.4).
Actual: The build fails with Could not find com.google.firebase:firebase-inappmessaging:. / Could not find com.google.firebase:firebase-inappmessaging-display:.
#18586 changed the plugin's android/build.gradle to expose the Firebase artifacts as api, while the Firebase BoM is still declared as implementation platform(...):
dependencies {
api firebaseCoreProject
implementation platform("com.google.firebase:firebase-bom:${getRootProjectExtOrCoreProperty("FirebaseSDKVersion", firebaseCoreProject)}")
// `api` so app Java compilation can resolve FirebaseInAppMessagingDisplay,
// which the plugin class implements.
api 'com.google.firebase:firebase-inappmessaging'
api 'com.google.firebase:firebase-inappmessaging-display'
implementation 'androidx.annotation:annotation:1.7.0'
}
The versionless api dependencies are exported to the consuming app's compile classpath, but the BoM is an implementation dependency, so its version constraints are not. As a result, the app sees firebase-inappmessaging and firebase-inappmessaging-display with an empty version.
Results with Flutter 3.47.8 (AGP 9.1.0, Gradle 9.3.1, KGP 2.4.0):
| firebase_in_app_messaging | firebase_core | Kotlin app (flutter create) |
Java app (flutter create -a java) |
|---|---|---|---|
| 0.9.4 | 4.15.2 | ✅ builds | ✅ builds |
| 0.10.0 | 5.1.0 | ❌ fails (:app:processDebugResources) |
❌ fails (:app:processDebugResources) |
| 0.10.1 | 5.1.0 | ❌ fails (:app:compileDebugKotlin) |
❌ fails (:app:processDebugResources) |
Workaround: add the Firebase BoM to the app module:
// android/app/build.gradle.kts
dependencies {
implementation(platform("com.google.firebase:firebase-bom:35.1.0"))
}
Reproducing the issue
flutter create --platforms android iam_reprocd iam_reproflutter pub add firebase_core firebase_in_app_messaging(resolvesfirebase_core5.1.0,firebase_in_app_messaging0.10.1)flutter build apk --debug
No Dart code changes or google-services.json are needed to reproduce; the failure happens while Gradle resolves dependencies.
Firebase Core version
5.1.0
Flutter Version
3.47.8
Relevant Log Output
Running Gradle task 'assembleDebug'...
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by net.rubygrapefruit.platform.internal.NativeLibraryLoader in an unnamed module (file:/Users/koji/.gradle/wrapper/dists/gradle-9.3.1-all/9ot9r568e8zfvvd4mn8rbu1j0/gradle-9.3.1/lib/native-platform-0.22-milestone-29.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled
WARNING: Your app uses the following plugins that apply Kotlin Gradle Plugin (KGP): firebase_core, firebase_in_app_messaging
Future versions of Flutter will fail to build if your app uses plugins that apply KGP.
Please check the changelogs of these plugins and upgrade to a version that supports Built-in Kotlin.
If no such version exists, report the issue to the plugin. If necessary, here is a guide on filing
an issue against a plugin: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-app-developers#report-incompatible-kotlin-gradle-plugin-usage-to-plugin-authors
If you are a plugin author, please migrate your plugin to Built-in Kotlin using this guide: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Error while evaluating property 'friendPathsSet$kotlin_gradle_plugin_common' of task ':app:compileDebugKotlin'.
> Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.google.firebase:firebase-inappmessaging:.
Required by:
project ':app' > project :firebase_in_app_messaging
> Could not find com.google.firebase:firebase-inappmessaging-display:.
Required by:
project ':app' > project :firebase_in_app_messaging
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights from a Build Scan (powered by Develocity).
> Get more help at https://help.gradle.org.
BUILD FAILED in 4s
Running Gradle task 'assembleDebug'... 4.4s
Gradle task assembleDebug failed with exit code 1
Flutter dependencies
Expand Flutter dependencies snippet
Dart SDK 3.13.7
Flutter SDK 3.47.8
iam_repro 1.0.0+1
dependencies:
- cupertino_icons 1.0.9
- firebase_core 5.1.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_in_app_messaging 0.10.1 [firebase_core firebase_core_platform_interface firebase_in_app_messaging_platform_interface flutter meta]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
dev dependencies:
- flutter_lints 6.0.0 [lints]
- flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing collection meta stream_channel]
transitive dependencies:
- _flutterfire_internals 1.3.79 [collection firebase_core firebase_core_platform_interface flutter meta]
- async 2.13.1 [collection meta]
- boolean_selector 2.1.2 [source_span string_scanner]
- characters 1.4.1
- clock 1.1.3
- collection 1.19.1
- fake_async 1.3.3 [clock collection]
- firebase_core_platform_interface 8.1.1 [collection flutter meta plugin_platform_interface]
- firebase_core_web 4.1.0 [firebase_core_platform_interface meta web]
- firebase_in_app_messaging_platform_interface 0.2.7+30 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- leak_tracker 11.0.2 [clock collection meta path vm_service]
- leak_tracker_flutter_testing 3.0.10 [flutter leak_tracker leak_tracker_testing matcher meta]
- leak_tracker_testing 3.0.2 [leak_tracker matcher meta]
- lints 6.1.0
- matcher 0.12.20 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.13.0 [collection]
- meta 1.18.3
- path 1.9.1
- plugin_platform_interface 2.1.8 [meta]
- sky_engine 0.0.0
- source_span 1.10.2 [collection path term_glyph]
- stack_trace 1.12.2 [path]
- stream_channel 2.1.4 [async]
- string_scanner 1.4.1 [source_span]
- term_glyph 1.2.2
- test_api 0.7.12 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
- vector_math 2.4.0
- vm_service 15.4.0
- web 1.1.2
Additional context and comments
Possible fix:
- Revert
firebase-inappmessagingandfirebase-inappmessaging-displaytoimplementation(as in 0.9.4), so they are not exported to the app. - Stop having
FirebaseInAppMessagingPluginimplementFirebaseInAppMessagingDisplaydirectly, and instead set a private property (for example, a lambda) as the display component, so the plugin class's public API no longer references Firebase In-App Messaging types and the app can compileGeneratedPluginRegistrantwithout them.
- 主要语言
- Dart
- 星标
- 9.3k
- 派生
- 4.1k
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 72
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/flutterfire 的其他 Issue
-
Needs Attention type: bug
难度 4/5 3-5 天 新手友好度 42/100
firebase/flutterfire#18906 ·
维护者通常 1 天内回复
-
[cloud_firestore][Android]: query snapshots() can deliver an older snapshot after a newer one since 6.7.0可能已有人在做 @KafuiDumeloo 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 45/100
firebase/flutterfire#18904 ·
维护者通常 1 天内回复
-
🚀 [firebase_core] Bump Firebase JS SDK (13.1.0 → 13.2.0)可能已有人在做 @SelaseKay 于 1 天前认领。 未关闭Needs Attention type: enhancement
难度 1/5 1 小时以内 新手友好度 25/100
firebase/flutterfire#18902 · 1 条评论 ·
维护者通常 1 天内回复
-
[firebase_messaging]: Android: dismissing a notification delivers an empty RemoteMessage to onMessage (Firebase's NOTIFICATION_DISMISS broadcast is read as a message)可能已有人在做 @akashdh11 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 38/100
firebase/flutterfire#18897 · 1 条评论 ·
维护者通常 1 天内回复
-
Needs Attention type: bug
难度 3/5 1-2 天 新手友好度 35/100
firebase/flutterfire#18894 · 1 条评论 · 4 个 reaction ·
维护者通常 1 天内回复
查看 firebase/flutterfire 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
MaikuB/flutter_local_notifications#2866 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
madeofpendletonwool/PinePods#1078 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
carp-dk/cognition_package#40 ·
-
难度 2/5 1-3 小时 新手友好度 86/100
daniel-pimenta-cc/ledor#58 ·
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复