error while importing com.google.firebase.database in the application
<p>I am integrating the Firebase with my application. For this I have created an account in it and then created an app in it. 
I have done all the requirements required in it and have also made changes to the build.gradle files in the android app.</p>

<p>I am following this link and doing what all is asked to in this link.
<a href="http://www.androidhive.info/2016/10/android-working-with-firebase-realtime-database/" rel="nofollow noreferrer">http://www.androidhive.info/2016/10/android-working-with-firebase-realtime-database/</a></p>

<p>Now I have set the database rules as follows:</p>

<pre><code>{
  "rules": {
    ".read": true,
    ".write": true
  }
}
</code></pre>

<p>Now when I want to make a User class and try this statement:
import com.google.firebase.database.DatabaseReference;</p>

<p>It is giving me error on database class.
What all do I need to do that I can easily import it in my application and then use the database service which is provided by Firebase.</p>

<p>My Build.gradle </p>

<p>// Top-level build file where you can add configuration options common to all sub-projects/modules.</p>

<pre><code>buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
</code></pre>

<p>Build.gradle(app-based)</p>

<pre><code>apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.2"

    defaultConfig {
        applicationId "com.example.hsports.galleryusingimageswitcher"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
}

apply plugin: 'com.google.gms.google-services'
</code></pre>