android - 编译 appcompat v7 :26. + 为融合位置提供者添加播放服务时出错

标签 android gradle android-gradle-plugin

我有一个问题并查看了可能重复的问题和答案,我认为其他人没有回答这个问题,所以在这里提问。

我更新了我的播放服务以使用融合位置提供程序,现在我的 gradle 中的 appcompat 显示错误。

所以我创建了一个新项目并检查了新项目上的 build.gradle 并且具有完全相同的 appcompat 但我的项目显示错误。

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
    applicationId "au.com.itmobilesupport.sqltwo"
    minSdkVersion 17
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.google.android.gms:play-services:11.0.1'
}

显示错误的是这一行:

compile 'com.android.support:appcompat-v7:26.+'

但在新项目中它很好。为什么我会收到错误消息?

更新:

如果我删除这两行,错误就会消失:

compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.google.android.gms:play-services:11.0.1'

但我需要它们,所以仍然有错误。

最佳答案

将这些行添加到您的 build.gradle 文件中,以获取您没有基于 Google site 的库.

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

Caution: Using dynamic dependencies (for example, palette-v7:23.0.+) can cause unexpected version updates and regression incompatibilities. We recommend that you explicitly specify a library version (for example, palette-v7:25.4.0) .

关于android - 编译 appcompat v7 :26. + 为融合位置提供者添加播放服务时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44642350/

相关文章:

java - 如何在运行应用程序时传递一个额外的 jar 来执行我的 java 命令?

android - 在 Android Studio 中重写 Gradle Remote Dependency 的 targetSdkVersion

android - SharedPreferences.getBoolean 每次都返回 true

java - 如何在不扫描所有 wifi 网络的情况下获取当前 wifi 连接的加密类型?

gradle - 从库中获取 gradle 变量

android - 无法使用 Superpowered 库为 arm64-v8a 创建 so 文件

android - 使用 Android Studio 3.X.X,将本地 .AAR 文件添加到 Gradle 构建不起作用

android - 监听android中的硬件按钮点击事件

android - 使用 GSON 解析多个对象

gradle - Eclipse Helios 3.6的Gradle eclipse插件