如何修复谷歌播放服务错误

新手上路,请多包涵

今天更新根文件夹中的播放服务后,我面临以下问题。我很困惑如何解决这个问题。

谁能帮我解决这个问题?

这个错误很烦人。不知道哪里有冲突。顺便说一下,为什么它在没有版本相互关联的情况下显示冲突。

错误

[[15.0.0,15.0.0], [15.0.2,15.0.2]] 的各种其他库正在请求库 com.google.android.gms:play-services-measurement-base,但解析为15.0.2。禁用插件并使用 ./gradlew :app:dependencies 检查您的依赖关系树。

build.gradle 脚本:

 apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
configurations.all {
    resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
    applicationId "community.infinity"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
aaptOptions {
    cruncherEnabled = false
}
dexOptions {
    preDexLibraries false
    javaMaxHeapSize "4g"
}
buildTypes {
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard- android.txt'), 'proguard-rules.pro'
    }
    debug {
        ext.enableCrashlytics = false
    }
}

compileOptions {
    targetCompatibility 1.8
    sourceCompatibility 1.8
}

}

 dependencies {

implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support'
    exclude module: 'support-annotations'
    exclude module: 'support-v4'
    exclude module: 'support-v13'
    exclude module: 'recyclerview-v7'
    exclude group: 'com.android.support', module: 'appcompat-v7'
})
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.adamstyrc.cookiecutter:cookie-cutter:1.0.2'
implementation 'com.allattentionhere:fabulousfilter:0.0.5'
implementation 'com.github.florent37:diagonallayout:1.0.6'
implementation 'com.flaviofaria:kenburnsview:1.0.7'
implementation 'com.vstechlab.easyfonts:easyfonts:1.0.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.github.pwittchen:swipe:0.1.0'
implementation 'com.thesurix.gesturerecycler:gesture-recycler:1.4.0'
implementation 'com.github.iammert:MaterialIntroView:1.6.0'
implementation 'com.github.oxoooo:touch-image-view:1.0.1'
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
implementation 'com.squareup.okhttp:okhttp-urlconnection:1.6.0'
implementation('io.socket:socket.io-client:0.8.3') {
    // excluding org.json which is provided by Android
    exclude group: 'org.json', module: 'json'
}
implementation 'com.google.gms:google-services:3.3.0'
implementation 'com.iceteck.silicompressorr:silicompressor:2.1'
implementation 'com.fenchtose.nocropper:nocropper:0.2.0'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation('com.google.guava:guava:23.4-android') {
    exclude group: 'com.android.support'
    exclude module: 'support-annotations'
    exclude module: 'support-v4'
    exclude module: 'support-v13'
    exclude module: 'recyclerview-v7'
    exclude group: 'com.android.support', module: 'appcompat-v7'
}
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
implementation 'com.orhanobut:hawk:2.0.1'
implementation 'com.zsoltsafrany:needle:1.0.0'
implementation 'com.github.madrapps:pikolo:1.1.6'
implementation 'jp.wasabeef:richeditor-android:1.2.2'
implementation 'com.android.support:palette-v7:27.1.1'
testImplementation 'junit:junit:4.12'
implementation('com.github.bumptech.glide:glide:4.4.0') {
    transitive = true
}
implementation ("com.github.bumptech.glide:recyclerview-integration:4.4.0")   {
    // Excludes the support library because it's already included by Glide.
    transitive = false
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
implementation 'com.android.support:multidex:1.0.3'
implementation "me.leolin:ShortcutBadger:1.1.21@aar"
implementation 'com.hbb20:ccp:2.1.2'

}

原文由 anonymous 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 658
2 个回答

您的依赖项之一是具有不同版本的 com.google.android.gms

更新

Firebase 依赖项具有与过去不同的独立版本。如果您有版本冲突,那么您可以更新您的 com.google.gms:google-services 。并开始定义独立版本。

更新 com.google.gms:google-services

转到顶部(项目)级别 build.gradle 并将 com.google.gms:google-services 更新到版本 4.1.0 或更新版本(如果有)。

 buildscript {
    ...
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        classpath 'com.google.gms:google-services:4.1.0' //< update this
    }
}

将 Firebase 依赖项更新到 最新版本

Firebase 依赖版本可以是单独的。所以检查 最新版本

 com.google.firebase:firebase-core:16.0.3    //Analytics
com.google.firebase:firebase-database:16.0.2    //Realtime Database

原始解决方案(有用)

解决方法:

  1. 从冲突的依赖项中 排除 com.google.android.gms
  2. 如果可用,请更新该依赖项。
  3. 将您的 com.google.android.gms 版本更改为冲突版本。

问题

如何查看正在使用哪个依赖 com.google.android.gms

1.通过命令解决

对于 Android,请使用此行

 gradle app:dependencies

或者如果你有一个 gradle 包装器:

 ./gradlew app:dependencies

其中 app 是您的项目模块。

此外,如果您想检查某些东西是否是 compiletestCompileandroidTestCompile 依赖关系以及将其拉入的原因:

 ./gradlew :app:dependencyInsight --configuration compile --dependency <name>
./gradlew :app:dependencyInsight --configuration testCompile --dependency <name>
./gradlew :app:dependencyInsight --configuration androidTestCompile --dependency <name>

2 使用这些插件

Gradle View 是一个 Android Studio 插件,您可以安装和显示依赖层次结构。 Methods Count 是另一个插件,它也显示依赖树。

原文由 Khemraj Sharma 发布,翻译遵循 CC BY-SA 4.0 许可协议

通过以下 android project.properties 中的更新解决问题

cordova.system.library.3=com.google.firebase:firebase-core:16.0.0
cordova.system.library.10=com.google.firebase:firebase-messaging:17.0.+

并在 android cordova 支持 google service -build.gradle

 dependencies {
    classpath 'com.android.tools.build:gradle:3.3.0'
    classpath 'com.google.gms:google-services:4.2.0'
}

ext.postBuildExtras = {
  if (project.extensions.findByName('googleServices') == null) {
    // apply plugin: 'com.google.gms.google-services'
    // class must be used instead of id(string) to be able to apply plugin from non-root gradle file
    apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
    googleServices { disableVersionCheck = true }
  }
}

这也可能对您有所帮助。

原文由 Jose G Varanam 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题