【问题标题】:Dependencies conflict issue in android studio's build.gradle file [closed]android studio的build.gradle文件中的依赖冲突问题[关闭]
【发布时间】:2017-10-19 09:27:00
【问题描述】:

在 build.gradle 文件中放置正确的依赖项时遇到问题。 我已经发布了问题的屏幕截图。请帮忙!!!!!!!!!!! Screenshot is here

【问题讨论】:

  • 这个错误没有告诉你具体该怎么做吗?
  • 不完全是。我已经尝试了很多不同版本的实验,但仍然无法解决
  • 请看一下截图,告诉我我是否使用了正确版本的依赖项。
  • 使用 10.0.1 版本。问题将得到解决。

标签: java android android-studio build.gradle


【解决方案1】:

我认为现在解决了以下是我所做的更改:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.firebase:firebase-appindexing:10.2.6'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.roughike:bottom-bar:2.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.firebase:firebase-ads:10.2.6'
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

对于 编译'com.google.android.gms:play-services-maps:10.2.6' 是在10.0.1之前,我改成10.2.6并同步了

对于 编译'com.google.firebase:firebase-ads:10.2.6' 它在 10.0.1 之前,我更改为 10.2.6 并同步它并且它工作..

谢谢大家:)

【讨论】:

  • 这正是我所拥有的,但仍然面临错误:(47, 13) 无法解决:com.google.firebase:firebase-appindexing:10.2.6 请提供更多帮助。
【解决方案2】:

首先,将规则添加到您的根级 build.gradle 文件中,以包含 google-services 插件:

   buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

然后,在您的模块 Gradle 文件(通常是 app/build.gradle)中,在文件底部添加 apply plugin 行以启用 Gradle 插件:

apply plugin: 'com.android.application'

android {
  // ...
}

dependencies {
  // ...
  compile 'com.google.firebase:firebase-core:10.2.6'

  // Getting a "Could not find" error? Make sure you have
  // the latest Google Repository in the Android SDK manager
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

【讨论】:

  • 我试过了,但仍然抛出错误“错误:任务 ':app:processDebugGoogleServices' 的执行失败。> 请通过更新 google-services 插件的版本来修复版本冲突(有关最新版本可在 bintray.com/android/android-tools/… 获得)或将 com.google.android.gms 的版本更新到 10.0.1。”
  • 请看一下截图,告诉我我是否使用了正确版本的依赖项。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-01-28
  • 2016-11-26
  • 2015-12-31
  • 2018-01-16
  • 2018-05-18
  • 2018-06-18
  • 1970-01-01
相关资源
最近更新 更多