我正在尝试将我的应用与firebase分析相关联。
Gradle任务时遇到问题:[:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
。
我已将implement 'com.google.firebase:firebase-core:11.6.0'
放在build.gradle中,如下所示。
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'
implementation 'com.google.firebase:firebase-core:11.6.0'
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-services'
gradle build完成了1个错误
Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.6.0.
有人能帮助我吗?提前谢谢。
答案 0 :(得分:0)
要解决此问题,您需要添加以下代码:
classpath 'com.google.gms:google-services:3.1.1'
来自dependencies
(项目)文件的build.gradle
。
也改变这行代码:
implementation 'com.google.android.gms:play-services-ads:11.4.2'
与
implementation 'com.google.android.gms:play-services-ads:11.6.0'
答案 1 :(得分:0)
您必须使用 firebase 库的相同版本和 google play服务库:
implementation 'com.google.firebase:firebase-core:11.6.0'
implementation 'com.google.android.gms:play-services-ads:11.6.0'