DatabaseException: Failed to get FirebaseDatabase instance: FirebaseApp object has no DatabaseURL in its FirebaseOptions object

2,520 views
Skip to first unread message

Steffen Mayer

unread,
May 23, 2016, 8:08:33 PM5/23/16
to Firebase Google Group
Hi,

I'm getting the following exception when I make a 'release' build with Dexguard/Proguard:
com.google.firebase.database.DatabaseException: Failed to get FirebaseDatabase instance: FirebaseApp object has no DatabaseURL in its FirebaseOptions object.
The  'debug' build is working fine.

Could it be that DexGuard/Proguard is messing with the "google-services.json" file (which has the "DatabaseURL") in the app folder of my project?

I already tried it with "-dontobfuscate" which did not help.

What else could be wrong?

Best regards,
Steffen

Kato Richardson

unread,
May 24, 2016, 11:05:37 AM5/24/16
to Firebase Google Group
Hi Steffen,

There are some instructions on configuring ProGuard here. Have you already tried that?

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/9d0dab12-1a7d-48c5-a2c2-ede46dae4a62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Steffen Mayer

unread,
May 24, 2016, 11:15:26 AM5/24/16
to Firebase Google Group
Hi Kato,

Thanks for your reply.

With the help of the DexGuard Support I just found the solution for my problem.

The values of the google-services.json are generated as strings in a value.xml file.

I had to add the following config to keep those values accessible:
-keepresources string/default_web_client_id
-keepresources string/firebase_database_url
-keepresources string/gcm_defaultSenderId
-keepresources string/google_api_key
-keepresources string/google_app_id
-keepresources string/google_crash_reporting_api_key
-keepresources string/google_storage_bucket
Best regards,
Steffen

Frank van Puffelen

unread,
May 24, 2016, 12:15:10 PM5/24/16
to Firebase Google Group
Thanks for responding back with the solution Steffen. I didn't realize that proguard would strip those values.

     puf

Steffen Mayer

unread,
May 24, 2016, 12:30:25 PM5/24/16
to Firebase Google Group
Btw. I'm using the commercial version of ProGuard (DexGuard). I'm not sure if ProGuard also strips those values.

I wonder though if it could be harmful if someone else reverse engineers those values?

Frank van Puffelen

unread,
May 24, 2016, 2:22:59 PM5/24/16
to Firebase Google Group
These values are all perfectly safe to keep in your APK. In fact with the web client, we include them in plain text.
Reply all
Reply to author
Forward
0 new messages