我想在我的应用程序中添加Firebase AdMob。
在build.gradle(Project)中,我有以下代码:
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
}
}
在 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'
我已更新谷歌游戏服务和存储库的版本。 当我同步项目时,仍然会出现以下错误。
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
有人可以帮助我如何解决这个错误吗?
google-services.json
文件? - Aman Jain