How to run debug app version on a 'debug' Firebase database
<p>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:</p>

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

<p>gradle.properties file:</p>

<pre><code>FIREBASE_REF_REL="https://xxxxxxx.firebaseio.com/"
FIREBASE_REF_DEB="https://xxxxxxx-dev.firebaseio.com/"
</code></pre>

<p>build.gradle file:</p>

<pre><code>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
    }
</code></pre>

<p>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.</p>

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

<p>When trying to reference my debug database I get the following type of errors:</p>

<pre><code>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
</code></pre>

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