capawesome-team / capacitor-firebase

⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the Web.
https://capawesome.io/plugins/firebase/
Apache License 2.0
382 stars 99 forks source link

bug: cannot find symbol variable AD_PERSONALIZATION #683

Closed klaurtar closed 2 months ago

klaurtar commented 2 months ago

Plugin(s)

Version

6.1.0

Platform(s)

Current behavior

When trying to run an Android app in Android studio that has capacitor-firebase/analytics@6.x.x and firebase@10.x.x installed through npm, the app fails with two errors stemming from FirebaseAnalyticsHelper.java file:

Screenshot 2024-07-26 at 9 09 38 PM

Expected behavior

The app should succeed in building and running with the latest version of capacitor-firebase/analytics and firebase installed

Reproduction

https://github.com/klaurtar/bad-capacitor-firebase/tree/main

Steps to reproduce

Clone the repo, and npm install the dependencies. Once that is done, use the comman ionic cap sync android then ionic cap open android to open the project in Android Studio. Press the play button and the app should error out.

Other information

No response

Capacitor doctor

[warn] The bundledWebRuntime configuration option has been deprecated. Can be safely deleted. 💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 6.1.1 @capacitor/core: 6.1.1 @capacitor/android: 6.1.1 @capacitor/ios: 6.1.1

Installed Dependencies:

@capacitor/core: 6.1.1 @capacitor/cli: 6.1.1 @capacitor/ios: 6.1.1 @capacitor/android: 6.1.1

[success] iOS looking great! 👌 [success] Android looking great! 👌

Before submitting

robingenz commented 2 months ago

Please sync your Gradle project files and try it again. Let me know if this helps.

klaurtar commented 2 months ago

@robingenz I have synced my Gradle project on both the reproduced error posted on Github and my real application and the same error persists. For now, the only way I have been able to get both applications to build and run is to revert back to @capacitor-firebase/analytics@5.4.1 using the force command which starts throwing peer dependency errors due to the capacitor v6 migration. Also, just to be thorough, iOS builds and runs successfully. Android is the only issue at v6.1.0

npm i @capacitor-firebase/analytics@5.4.1 --force

robingenz commented 2 months ago

@klaurtar I took a look at your linked reproduction. Unfortunately, it is not a minimal, reproducible example. There are way too many dependencies. Please have a look at the Capacitor Firebase Plugin Demo app. It uses capacitor-firebase/analytics@6.x.x and firebase@10.x.x and I could not reproduce your problem there.

klaurtar commented 2 months ago

@klaurtar I took a look at your linked reproduction. Unfortunately, it is not a minimal, reproducible example. There are way too many dependencies. Please have a look at the Capacitor Firebase Plugin Demo app. It uses capacitor-firebase/analytics@6.x.x and firebase@10.x.x and I could not reproduce your problem there.

Ok, please do not close this topic. I will reproduce a minimal example with less dependencies and add it to the bug report.

klaurtar commented 2 months ago

@robingenz Please check the provided repo again. I have npm uninstalled all npm packages aside from the the basic necessary requirements to scaffold an android app using the Ionic framework. I have kept "@capacitor-firebase/analytics": "^6.1.0"

This example has no bloat and is failing.

robingenz commented 2 months ago

You specified a custom Firebase Analytics version instead of using the plugins default one. This fixes your issue:

grafik

klaurtar commented 2 months ago

Thanks for the quick reply. I believe I added this due to the instructions for the npm package. I don't need to specify it for it to work? Here is the part of the docs that caused confusion:

Screenshot_2024-07-31-08-48-47-83_40deb401b9ffe8e1df2f1cc5ba480b12.jpg

robingenz commented 2 months ago

No, you don't need to specify it. The plugin will use the variable if a variable exists. Otherwise the default version is used.

I will close this issue as completed.