'Can't connect to Firebase in Android Studio

I’ve tried all solutions and I still can’t make my app connected to Firebase server

https://i.stack.imgur.com/0WZbP.jpg

noted that I’m using this build.gradle in root ;

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

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.2.0'





        buildscript {

        }

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



allprojects {


}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

and this one for App gradle ;

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    signingConfigs {
        config1 {
            keyAlias 'key0'
            keyPassword '000000'
            storeFile file('C:/filepath/filename.jks')
            storePassword 'password'
        }
    }
    defaultConfig {
        applicationId "com.example.last"
        minSdkVersion 21
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        signingConfig signingConfigs.config1
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
    compileSdkVersion 28
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.6'
    android {
        // ...

    }}
apply plugin: 'com.google.gms.google-services'

I installed the google-services.json file

Nothing is working and I completed all required steps , still have no connection

Does anyone can help me ?

Thanks



Solution 1:[1]

You have to build and run your very first app to get a tick on the "Run your app to verify installation".

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ujjwal Jung Thapa