capacitor-community / capacitor-community/firebase-analytics
FirebaseAnalytics.initializeFirebase is not a function on a vanilla angular project
- Dominant language
- Java
- Stars
- 178
- Forks
- 70
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Starting an angular vanilla project with firebase-analytics throws a `initializeFirebase is not a function` error. Note that Firebase itself does work (the default events), as can be seen on the xcode console and on firebase analytics debug steam.
**To Reproduce**
1. run the following script
```
project_name="ABC"
project_id="com.company.abc"
ionic start "$project_name" "sidemenu" --type="angular" --project-id="$project_id" --package-id="$project_id" --capacitor --no-interactive
cd "$project_id"
yarn add "@capacitor-community/firebase-analytics"
mkdir www && touch www/index.html
sudo gem install cocoapods
ionic cap add "ios"
ionic cap sync
```
2. Add `GoogleService-Info.plist` via xcode
3. Add `import`s and `FirebaseAnalytics.initializeFirebase` per the [code examples](https://github.com/capacitor-community/firebase-analytics#usage) with the correct init options taken from `GoogleService-Info.plist` (btw, why do we need this data duplicity -- it's bug prone).
**Bug**
The following error appears on xcode console:
```
[error] - ERROR Error: Uncaught (in promise): TypeError: Z.initializeFirebase is not a function. (In 'Z.initializeFirebase(...)', 'Z.initializeFirebase' is undefined)
```
**Expected behavior**
Not to have an error.
**Smartphone**
- Device: emulator iphone 8 and real iphone 8.
- OS: iOS 13.7
Contributor guide
Assessment
This issue has not been assessed yet.