How to run debug app version on a 'debug' Firebase database

Peter

in the Google I/O 2016 sessions the big improvements towards full integration of Firebase has been shown. In my apps, I'm trying to migrate to the new solution(s) but have several questions. One of them is the following:

In my Firebase apps, I used a parameter to define the Firebase database as follows (gradle):

gradle.properties file:

FIREBASE_REF_REL="https://xxxxxxx.firebaseio.com/"
FIREBASE_REF_DEB="https://xxxxxxx-dev.firebaseio.com/"

build.gradle file:

buildTypes {
        debug {
            minifyEnabled false
            multiDexEnabled true
            it.buildConfigField 'String', 'FIREBASE_ROOT_URL', FIREBASE_REF_DEB
        }
        release {
            minifyEnabled true
            useProguard true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            zipAlignEnabled true
            it.buildConfigField 'String', 'FIREBASE_ROOT_URL', FIREBASE_REF_REL
        }
        return true
    }

This allowed me to run my debug apps against a debug Firebase environment which helped me to test changes in the datamodel and security rules without affecting the production environment.

In the new Firebase solution this does not seem possible anymore because of the generated google-services.json file which contains the Firebase reference (as explained here: https://firebase.google.com/support/guides/firebase-android#import_your_project_to_the_new_firebase_console_numbered).

When trying to reference my debug database I get the following type of errors:

Caused by: com.google.firebase.database.DatabaseException: Invalid URL (https://xxxxxxx-dev.firebaseio.com/) passed to getReference().  URL was expected to match configured Database URL: https://xxxxx.firebaseio.com

My question: what is the correct way/best practice to run an app against a test Firebase database in the new situation?

Gabriele Mariotti

I am not sure that it is the best practice.

You can use different google-services.json files.
I am investiganting about the current plugin (com.google.gms:google-services:3.0.0) if it supports build types. The previous one (com.google.gms:google-services:2.1.X) supported flavors but not types.

In any case you should be able to use somenthing like this:

app/src/release/google-services.json
app/google-services.json

In this case the plugin looks in the locations and stops when it finds a google-services.json file.

In this way you should be able to use different firebase apps for debug and release.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to run debug app version on a 'debug' Firebase database

From Dev

Android Studio: run/debug release version of app

From Dev

How to run Dropwizard app in debug mode with Eclipse?

From Dev

Firebase realtime database not returning all values on Android debug APK version

From Dev

Firebase realtime database not returning all values on Android debug APK version

From Java

How to disable Firebase Crash Reporting when the app is running on debug?

From Dev

How to connect/debug Firebase connectivity on a React-Native Android App

From Dev

AndroidStudio 0.8.2 Run App or Debug App fails

From Dev

How to RUN and Login to a container to debug ?

From Dev

how to run hive in debug mode

From Dev

How to debug Android App in Exclipse?

From Dev

How to debug a nodejs readline app?

From Dev

How to debug slow app launch

From Dev

How to debug a kivy app in android?

From Dev

How to debug an app on Pixel 2

From Dev

App Engine: debug and run differ (mystery)

From Dev

Android Studio cannot run for debug the app

From Dev

How to run the Wear app with handled app with out any signing? I mean developer debug mode

From Dev

How to debug app without uninstall release app

From Dev

How to debug app without uninstall release app

From Dev

How to know if the CPython executable is the debug version, in python?

From Dev

How to change setting for debug version in Android Studio

From Dev

How do I make my debug app version receive production push notifications on iOS?

From Dev

How to export and import Run/Debug configurations in PHPStorm?

From Dev

How to set Debug/Run config for Tomcat in intelliJ

From Java

How to run application as administrator in debug with Visual Studio?

From Dev

How to run application with library in debug build variant?

From Dev

How to debug firefox extension after cfx run?

From Dev

how to debug or run pytest scripts using eclipse?

Related Related

  1. 1

    How to run debug app version on a 'debug' Firebase database

  2. 2

    Android Studio: run/debug release version of app

  3. 3

    How to run Dropwizard app in debug mode with Eclipse?

  4. 4

    Firebase realtime database not returning all values on Android debug APK version

  5. 5

    Firebase realtime database not returning all values on Android debug APK version

  6. 6

    How to disable Firebase Crash Reporting when the app is running on debug?

  7. 7

    How to connect/debug Firebase connectivity on a React-Native Android App

  8. 8

    AndroidStudio 0.8.2 Run App or Debug App fails

  9. 9

    How to RUN and Login to a container to debug ?

  10. 10

    how to run hive in debug mode

  11. 11

    How to debug Android App in Exclipse?

  12. 12

    How to debug a nodejs readline app?

  13. 13

    How to debug slow app launch

  14. 14

    How to debug a kivy app in android?

  15. 15

    How to debug an app on Pixel 2

  16. 16

    App Engine: debug and run differ (mystery)

  17. 17

    Android Studio cannot run for debug the app

  18. 18

    How to run the Wear app with handled app with out any signing? I mean developer debug mode

  19. 19

    How to debug app without uninstall release app

  20. 20

    How to debug app without uninstall release app

  21. 21

    How to know if the CPython executable is the debug version, in python?

  22. 22

    How to change setting for debug version in Android Studio

  23. 23

    How do I make my debug app version receive production push notifications on iOS?

  24. 24

    How to export and import Run/Debug configurations in PHPStorm?

  25. 25

    How to set Debug/Run config for Tomcat in intelliJ

  26. 26

    How to run application as administrator in debug with Visual Studio?

  27. 27

    How to run application with library in debug build variant?

  28. 28

    How to debug firefox extension after cfx run?

  29. 29

    how to debug or run pytest scripts using eclipse?

HotTag

Archive