0

The file google-sevices.json is missing from module root folder even the file is in the app directory. My gradle version is 2.10. I have spent most of my time to solve this issue but still I cannot resolve the issue.

Project-level gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        classpath 'com.google.gms:google-services:2.1.0' //this is the latest version
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

App-Level gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {

        applicationId "com.myairticket.testpush3"
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {

            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets { main { res.srcDirs = \['src/main/res', 'src/main/jsonfiles'\] } }
}
dependencies {
    compile fileTree(dir: 'libs', include: \['*.jar'\])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
}
apply plugin:'com.google.gms.google-services
Allan Pereira
  • 2,572
  • 4
  • 21
  • 28
  • 1
    refer http://stackoverflow.com/questions/32072568/add-google-services-json-in-android-studio – sasikumar Apr 29 '16 at 13:20
  • check google-services.json file in app directory – sasikumar Apr 29 '16 at 13:28
  • yes it is .the file is in app directory still i m getting error – Developer-5037 Apr 29 '16 at 13:51
  • Check this [link](http://stackoverflow.com/questions/33866061/file-google-services-json-is-missing-from-module-root-folder-the-google-service). *"You need to get the configuration file from the developer's site and paste it in the app level directory of your project."* – abielita Apr 30 '16 at 03:18
  • I would double check that it's in your app folder and not in the /res folder. If you dragged the file in to AS and you were in the Android view instead of Project Files, there's a good chance it got copied into the wrong directory. – sublimental May 01 '16 at 13:04
  • Have you done a clean build after adding the google-services.json? I think what @sublimental mentioned is highly possible. – AL. May 02 '16 at 09:04

1 Answers1

0

I would double check that it's in your app folder and not in the /res folder. If you dragged the file in to Android Studio and you were in the Android view instead of Project Files, there's a good chance it got copied into the wrong directory.

sublimental
  • 381
  • 1
  • 4
  • 9