【问题标题】:Incompatible libraries in gradlegradle 中不兼容的库
【发布时间】:2015-12-29 07:40:27
【问题描述】:

我想在我的应用程序中使用 gcm,但是在 gradle 文件中添加依赖项时,我收到了不兼容库的错误。 我的应用程序级 gradle 文件具有如下依赖项..

apply plugin: 'com.google.gms.google-services'
 .
 .
 .
 .
 .
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.6.0'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.okhttp:logging-interceptor:2.6.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.appvirality:AppviralityUI:1.1.18+'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
}

我已经添加了classpath 'com.google.gms:google-services:1.5.0-beta2' 在我的项目级 gradle 中。

我的 google play 服务已更新到最新版本,但仍然显示错误,例如.. 所有库必须使用完全相同的版本规范。 检查后我知道它与compile 'com.appvirality:AppviralityUI:1.1.18+' library 冲突。

谢谢

【问题讨论】:

标签: android gradle android-support-library


【解决方案1】:

首先你需要改变这个

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

使用

apply plugin: 'com.android.application'

您可以将您的类路径设置为classpath 'com.android.tools.build:gradle:1.5.0'

【讨论】:

  • 我已经添加了你说的这两行......但它不起作用我已经点击链接developers.google.com/cloud-messaging/android/client
  • @Newbiee apply plugin: 'com.android.library' 设置这个。
  • 在添加它时.. 它显示错误,如“无法添加名称为 android 的扩展,因为它已经注册”作为应用插件:'com.android.application' 已经存在
  • @Newbiee apply plugin: 'android'
  • 你能检查一下编辑吗?..我添加了冲突库
【解决方案2】:

不知道怎么做.. 但是,只需将编译 'com.google.android.gms:play-services-gcm:8.3.0' 更改为 compile 'com.google.android.gms:play-services:8.3.0' 就会出错

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-01
    • 2021-03-03
    • 1970-01-01
    • 1970-01-01
    • 2017-08-30
    • 2015-05-30
    • 2020-09-03
    • 2018-08-07
    相关资源
    最近更新 更多