2016-04-29 130 views
0

即使文件位於應用程序目錄中,文件google-sevices.json從模塊根文件夾中缺失。我的gradle版本是2.10。我花了大部分時間來解決這個問題,但我仍然無法解決問題。google-services.json缺少錯誤

項目級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() 
    } 
} 

應用級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 
+1

參考http://stackoverflow.com/questions/32072568/add-google-services-json-in-android-studio – sasikumar

+0

檢查應用程序目錄中的google-services.json文件 – sasikumar

+0

是的,它是。文件在應用程序中目錄仍然沒有得到錯誤 –

回答

0

我會仔細檢查,它在你的應用程序文件夾中,而不是在/ res文件夾。如果您將文件拖放到Android Studio中,並且您在Android視圖中而不是在項目文件中,則很可能會將其複製到錯誤的目錄中。