Reputation: 3192
I am trying to add firebase addmob in my app.
In build.gradle(Project) i have following code
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.gms: google-services: 3.0.0'
classpath 'com.android.tools.build:gradle:2.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
In build.gradle(module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.myname.examp.myapp"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.google.firebase: firebase-ads: 9.0.0'
}
apply plugin: 'com.google.gms.google-services'
I have updated version of google play service and repository
When I sync project still i am getting following error
Error:Could not find com.google.gms: google-services: 3.0.0.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio2/gradle/m2repository/com/google/gms/ google-services/ 3.0.0/ google-services- 3.0.0.pom
file:/C:/Program Files/Android/Android Studio2/gradle/m2repository/com/google/gms/ google-services/ 3.0.0/ google-services- 3.0.0.jar
https://jcenter.bintray.com/com/google/gms/ google-services/ 3.0.0/ google-services- 3.0.0.pom
https://jcenter.bintray.com/com/google/gms/ google-services/ 3.0.0/ google-services- 3.0.0.jar
Required by:
:MyApplication:unspecified
Can some one help me how to fix this error
Upvotes: 10
Views: 29908
Reputation: 659
I was facing similar issue with flutter project for classpath 'com.google.gms:google-services:4.3.15'
For Instance of firebase in app
curl -sL https://firebase.tools | bash
dart pub global activate flutterfire_cli
firebase login
flutterfire configure --project=projectId
Upvotes: 0
Reputation: 659
I was facing similar issue with flutter project for classpath 'com.google.gms:google-services:4.3.15'
For Instance of firebase in app
curl -sL https://firebase.tools | bash
dart pub global activate flutterfire_cli
firebase login
flutterfire configure --project=projectId
Upvotes: 0
Reputation: 101
I had the same error.
I had solved the problem by changing
classpath 'com.google.gms:google-services:4.3.3'
to
classpath 'com.google.gms:google-services:4.3.0'
Maybe you need to downgrade version
Upvotes: 0
Reputation: 952
add the classpath in the build.gradle at your project level not the one in module level.
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
and then apply it in the module level.
apply plugin: 'com.google.gms.google-services'
Upvotes: 0
Reputation: 21
Move class path dependency to project level build.gradle
file as follows :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
and ensure that the apply plugin line after dependencies in your build.gradle file in app folder as follows
apply plugin: 'com.google.gms.google-services'
Upvotes: 2
Reputation: 1
Error:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection Possible causes for this unexpected error include:
Upvotes: -2
Reputation: 512
Add the class path line in the top level gradle file. Not in the same file where you add individual dependencies.
Upvotes: 3
Reputation: 3364
I had similar problem, I copied the dependency from the firebase instructions and pasted in code.
From instructions:
classpath 'com.google.gms: google-services: 3.0.0'
Supposed to be:
classpath 'com.google.gms:google-services:3.0.0'
Should not include any spaces. Silly but wasted half an hour.
Upvotes: 17