Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
658 views
in Technique[技术] by (71.8m points)

firebase - FirebaseApp initialization unsuccessful in Android Instant apps

I am currently working on an exiting Android application in order to create an Instant apps version.

My Android Studio is now split into several modules :

  • the business object module (which is a library)
  • the base -feature- module
  • the moduleA -feature- module
  • the app module (which is a phone/tablet module)
  • the instant module (which is an instant apps module)

My instant app module can be compiled and launched on a phone/tablet but each time it crashes due to Firebase issues. I have the following message into the logcat :

I/FirebaseInitProvider: FirebaseApp initialization unsuccessful

According to the documentation the Firebase library is compatible with Instant Apps, but I am pretty sure that I do not move the google-services.json file into the right place in my project...

Here what I have done :

  1. I defined the following classpath dependencies into the build.gradle file of the Android Studio project : classpath 'com.google.gms:google-services:3.1.1'

  2. I put the google-services.json file into my module base (because the documentation asks for it)

Now, if I try to apply the plugin (apply plugin: 'com.google.gms.google-services') into the build.gradle file of the base module, I cannot compile. I have the following message :

Error:Execution failed for task ':base:processGooglePlayProductionDebugFeatureGoogleServices'.

> No matching client found for package name 'com.mycompany.myapp.base'

In fact, the package name defined into the google-services.json file is the one use by the app (because according to the documentation the base library cannot have the same package name as the installed android app.

I also tried to apply the plugin into the build.gradle files of the installed app and into the instant apps module leaving the google-services.json file into the base module. The app compile but I have the log : "FirebaseApp initialization unsuccessful".

So I tried moving the google-services.json file into my instant app module but I still have the log : "FirebaseApp initialization unsuccessful"

I also tried to force the initialization calling the static method initializeApp from the FirebaseApp class but the log persists.

I cannot find an example of implementation on the web. In fact, the Google Sample repository does not use a google-services.json file.

Thank you in advance for your help !

Edit : Here the dependencies of my modules :

The dependencies of my base -feature- module :

  implementation project(':businessobject')
  feature project(':moduleA')
  application project(':app')

The dependencies of my moduleA -feature- module :

api project(':base')
api project(':businessobject')

The dependencies of my app module (which is a phone/tablet module) :

implementation (project(':base'))
implementation (project(':businessobject'))
implementation (project(':moduleA'))

The dependencies of my instant module (which is an instant apps module) :

implementation project(':base')
implementation project(':businessobject')
implementation project(':moduleA')
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

Just Browsing Browsing

[4] html - How to create even cell spacing within a

2.1m questions

2.1m answers

60 comments

56.8k users

...