Ad

How To Use Firebase In Android?

I am getting mad from gradle issues after adding Firebase to my app, I get the error: class file for com.google.android.gms.internal.zzbgl not found

I am using android location and url stringRequest, until then it worked well, then I have added Firebase to the gradle (I have registered in the Firebase website and added the generated google-services.json)

I checked for alot of answeres that didnt help, I have updated gradle to 3.4.2 still not working

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "com.example.mapwithmarker"
        minSdkVersion 22
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        resValue "string", "google_maps_key", (project.findProperty("GOOGLE_MAPS_API_KEY") ?: "")
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    testImplementation 'junit:junit:4.12'
}

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


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

buildscript {
    repositories {
        jcenter()
        google()
        //maven {
         //   url "https://maven.google.com"
        //}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.gms:google-services:4.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

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

any help please?

Ad

Answer

Fixed by: ...

    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.google.firebase:firebase-core:12.0.1'
    testImplementation 'junit:junit:4.12'
}

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

thanks

Ad
source: stackoverflow.com
Ad