7

I'm working in migrating App to support Instant App.

So, I have modularized my project structure as follow

My Project Structure

But when I'm adding Firebase, only firebase Analytics can works with it. Another feature like Firebase Auth, Storage, Firestore, And Database are not working in here.

I Got an Error :

Firebase App Not Initialized.
Although I have declared FirebaseApp.Initialize(this) through Activity 
or Application class.

But Firebase Analytic can works just fine.

Here my Code in an Activity

Here my Gradle

Please help if anyone know how to solve this.

Prags
  • 2,457
  • 2
  • 21
  • 38
Darari Nur Amali
  • 465
  • 3
  • 13
  • I've had this too and was unable to find a solution. – dazza5000 Feb 10 '18 at 00:13
  • can you check this url for understanding https://stackoverflow.com/questions/48292901/firebase-support-library-dependency-conflict-for-instant-apps, might it help you. – Prags Feb 12 '18 at 06:19
  • Can you check this URL for more help https://codelabs.developers.google.com/codelabs/firebase-android/index.html?index=..%2F..%2Findex#0 – Prags Feb 13 '18 at 10:59
  • @PragatiSingh does that take into an account this is an instant app? – dazza5000 Feb 14 '18 at 00:02
  • @PragatiSingh yeah, thanks, but I had been able to use firebase on legacy apps. But Firebase still not works in Instant App Project. – Darari Nur Amali Feb 14 '18 at 15:10
  • Can you file a bug to Google, then link to it back in here? It would be helpful for all, thanks! https://issuetracker.google.com/issues/new?component=316045&template=1018787 – Prags Feb 15 '18 at 07:58
  • or can you check https://firebase.google.com/support/ for more help. – Prags Feb 15 '18 at 17:15
  • Have you tried initializing it in your `Application` class? I have Firebase working in my AIA and that's the only difference I see. – Kyle Venn Feb 15 '18 at 17:30
  • @KyleVenn Can you show us in step by step? Firebase Analytics can work seamlessly but not for the others. Yeah I have tried initialized it on my Application class which declared as Application name in manifest. – Darari Nur Amali Feb 16 '18 at 10:26
  • My apologies, I only have Firebase Analytics working as well. That's the only one we've needed. One thought that comes to mind is that the other Firebase libraries most likely require permissions that aren't allowed in AIA. Anything using disk isn't allowed in AIA. – Kyle Venn Feb 16 '18 at 15:17
  • @DarariNurAmali, I hope your problem has been resolve or you have file a bug to google,please confirm. Thanks! – Prags Feb 20 '18 at 11:29
  • @PragatiSingh nope, I still have a problem here. Can you teach me how to send a bug to google? what should I send? – Darari Nur Amali Feb 26 '18 at 14:14
  • @DarariNurAmali, You can follow this link, information available there to help `how to file bug`. https://issuetracker.google.com/issues/new?component=316045&template=1018787 – Prags Feb 27 '18 at 02:00
  • @DarariNurAmali , have you report it to google team? if yes, you can update link to here. – Prags Feb 28 '18 at 09:16
  • We are having the same error on our instant app. Any update on this? Any link to a google bug? – Aracem Apr 19 '18 at 10:48
  • I found this related report: https://issuetracker.google.com/issues/72422073 – Aracem Apr 19 '18 at 10:52
  • See also https://stackoverflow.com/questions/47576360/firebase-analytics-not-working-with-instant-app-or-normal-app – Vall0n Mar 01 '19 at 13:44

2 Answers2

2

As you can see on this bug report there is a problem on the documentation and/or on the google service plugin. To resolve it you have to add the google-service.json and the apply plugin: 'com.google.gms.google-services code in every module and build.gradle file.

Aracem
  • 7,227
  • 4
  • 35
  • 72
0

I have similar problem and solved by doing this:

  1. Add apply plugin: 'com.google.gms.google-services'
  2. Add com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
  3. Add apply plugin: 'io.fabric' bellow apply plugin: 'com.android.application[features]'

In every build.gradle module file

Arie Agung
  • 108
  • 1
  • 8