Android 支持库 - 无法解决

标签 android gradle android-support-library

<分区>

我正在尝试将以下支持库添加到我的 buid.gradle 中:

 buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }
}

apply plugin: 'com.android.application'

repositories {
    mavenCentral()
}

android {
    useLibrary 'org.apache.http.legacy'

    compileSdkVersion 26
    buildToolsVersion "23.0.3"

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 26

    }

    signingConfigs {
        release {

        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}

repositories {
    jcenter()
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.android.support:support-v7:26.0.0'
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'com.android.support:cardview-v7:26.0.0'
    compile 'com.melnykov:floatingactionbutton:1.1.0'
    compile 'it.sephiroth.android.library.imagezoom:imagezoom:1.0.5'
    //Apptentive
    compile 'com.apptentive:apptentive-android:2.1.3@aar'
    //compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.0.0'

}

我收到错误消息,指出每个库都“无法解析”,后面跟着上面的每一行代码。我希望与最新的支持库保持同步,以获得常规支持、appcompat 和 cardview。

最佳答案

要使用从版本 26.0.0 开始的支持库,您需要将 Google 的 Maven 存储库添加到项目的 build.gradle 文件中,如所述 here .

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

关于Android 支持库 - 无法解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45450687/

相关文章:

android - Gradle | Jacoco 任务 |测试报告

android - gradle 中不兼容的库

java - android.support.v7.widget.RecyclerView 无法实例化

android - 谷歌地图 Android API v2 : Is there a quick way to know if there is a Marker at a given location?

java - 带图像的 android 按钮

android - Android 上的 ext4 挂载选项

java - 如何包括用于编译类的库文件夹

android - 如何从 Android App Bundle 生成的 Google Play Console 安装 APK?

android - 无法从 Gradle 中的 jitpack 添加库

android - 添加 'tools:replace="安卓 :value"' to &lt;meta-data> element at AndroidManifest