Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have a gradle sync error JAVA_LETTER_OR_DIGIT when trying to add Firebase to my android project

When I added the dependencies as told in the firebase guide and sync the project ,I get the error JAVA__LETTER_OR_DIGIT .I work with MAC OS X Yosemite and my android studio version is 3.1.4

My app grade file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "e.apple.mse_project"
        minSdkVersion 22
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-analytics:17.2.0'
    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'
}

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

My project grade file

// 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.1.4'
        classpath 'com.google.gms:google-services:4.3.2'


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

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

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

This is the error that I get in the build console The error log that shows in my build console

Thanks in advance !

like image 860
Himashinee Avatar asked Jan 25 '23 19:01

Himashinee


1 Answers

The problem is with Android gradle plugin which doesn't work well with Google's Maven repository.

You can downgrade your google-services down to 4.2.0 as it was said by @mownathi-manigundan. Version 4.2.0 is available in AndroidTools Repository which outdated gradle plugin handles just fine

But it'd be better to update your plugin up to 3.2 or higher and use recommended com.google.gms:google-services:4.3.2. You can read more here how to to this

like image 119
dezhik Avatar answered Jan 28 '23 09:01

dezhik