2017-11-07 25 views
1

firebase-consoleに自分のアプリを接続しようとしています。 私は指示に従ってステップに従います。 この手順に従うときGradle sync Failed - idが 'com.google.gms.google-play-services'のプラグインが見つかりません

"GradleのGoogleサービスプラグインには、ダウンロードしたgoogle-services.jsonファイルが含まれています。このプラグインを使用するようにbuild.gradeファイルを変更してください。

プロジェクトレベルのbuild.gradle:

... 
    // Add to the bottom of the file 
    apply plugin: 'com.google.gms.google-services' 

はその後、同期しようとして

buildscript { 
     dependencies { 
     // Add this line 
     classpath 'com.google.gms:google-services:3.1.0' 
     } 
    } 

アプリレベルのbuild.gradle、私はこのエラー

Error(31,0) Plugin with id 'com.google.gms.google-play-services' not found 

を持って... 誰かが私にこれを解決させる手助けをすることができますか? これは私のコードです。

buildscript { 

    repositories { 
     google() 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.0' 
     classpath 'com.google.gms:google-services:3.1.0' 


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

allprojects { 
    repositories { 
     google() 
     jcenter() 
     maven { 
      url "https://maven.google.com" 
     } 
    } 
} 

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

アプリbuild.gradle

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    defaultConfig { 
     applicationId "com.example.kreuzell.myapplicationss" 
     minSdkVersion 15 
     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.0.2' 
    testImplementation 'junit:junit:4.12' 
    androidTestImplementation 'com.android.support.test:runner:1.0.1' 
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 
    implementation 'com.google.android.gms:play-services-ads:11.4.2' 
} 

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

答えて

2

変更build.gradle

プロジェクトこの:これに

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

apply plugin: 'com.google.gms.google-services' 
関連する問題