Reputation: 85
I'm facing this problem for a long time and I did not find any solution so I hope to find it Here.
What I did to solve this problem:
apply plugin: 'com.google.gms.google-services'
it runs without any problem.Error:FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:processDebugGoogleServices'.
File google-services.json is missing. The Google Services Plugin cannot function without it. Searched Location:
C:\Users\Mrwan\Desktop\QassWaNwadar\app\src\nullnull\debug\google-services.json C:\Users\Mrwan\Desktop\QassWaNwadar\app\src\debug\nullnull\google-services.json C:\Users\Mrwan\Desktop\QassWaNwadar\app\src\nullnull\google-services.json C:\Users\Mrwan\Desktop\QassWaNwadar\app\src\debug\google-services.json C:\Users\Mrwan\Desktop\QassWaNwadar\app\src\nullnullDebug\google-services.json C:\Users\Mrwan\Desktop\QassWaNwadar\app\google-services.jsonTry: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 6s
Gradle Module app
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.date.brian.cradletest"
minSdkVersion 15
targetSdkVersion 27
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.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.getbase:floatingactionbutton:1.9.0'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Upvotes: 4
Views: 8723
Reputation: 24907
Purpose of apply plugin: 'com.google.gms.google-services'
is to add dependencies for basic libraries required for the services you have enabled.
Since you have already included implementation 'com.google.android.gms:play-services-ads:15.0.1'
you don't actually need it. Removing apply plugin: 'com.google.gms.google-services'
should work as your expected.
If you want to continue using apply plugin: 'com.google.gms.google-services'
then, as the error says:
File google-services.json is missing.
You are missing google-services.json
file which is generally placed in the app/ directory (at the root of the Android Studio app module). You can follow this official document to add this file correctly.
Note: Also ensure that all your support libraries share same version.
Upvotes: 1