有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java无法解析:com。安卓支持:supportv4:26.0.2

当我使用此库时:

compile 'co.ronash.安卓:pushe-base:1.4.0'

我在gradle中得到这个错误:

Failed to resolve: com.安卓.support:support-v4:26.0.2

我修不好

有一个解决方案可以忽略该库 'com.安卓.support:support-v4:26.0.2'从{}开始

因为我已经编译了更新版本的support-v4库

gradle中的所有依赖项代码:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
安卓TestCompile('com.安卓.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.安卓.support', module: 'support-annotations'
})
compile 'com.安卓.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.安卓.support:appcompat-v7:26.0.0-alpha1'
compile 'com.安卓.support:support-v4:26.+' //--> its ok and no problem
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'co.ronash.安卓:pushe-base:1.4.0' //--->this code is error Failed to resolve: com.安卓.support:support-v4:26.0.2
compile 'com.google.安卓.gms:play-services-gcm:11.0.4'
compile 'com.google.安卓.gms:play-services-location:11.0.4'
testCompile 'junit:junit:4.12'
}

共 (1) 个答案

  1. # 1 楼答案

    有几个原因可以导致这种问题
    签出这些解决方案,我想它可能会帮助您:

    1.删除push并尝试添加版本为26.0.2support-v4库,以确保它已下载并缓存到系统中
    compile 'com.android.support:support-v4:26.0.2' // or implementation

    如果它仍然无法解决,那么从它的存储库服务器获取它时就会出现问题。签出build.gradle(project:your_prj)并确保此块有效

    allprojects {
        repositories {
            google() // or maven { url 'https://maven.google.com/' } for lower gradles
            jcenter()
        }
    }
    

    如果您的国家被包括在制裁范围内,您可能需要使用VPN才能获得它们。您还可以使用Fod(如果可以的话也可以捐赠,因为它是开源的)或shecan之类的代理。 请记住,所有支持库最好是26.0.2,以避免冲突和崩溃。您的支持库是26.0.0-alpha1,它较低

    1. 成功添加并缓存support-v4后,再次尝试向依赖项添加push

    还要记住,Push中捆绑了一个support-v4,您实际上不需要自己添加它

    并确保您有

    <uses-sdk tools:overrideLibrary="co.ronash.pushe" />

    在你的清单中。因此,您可以覆盖它的库和依赖项。 最后,保持您的SDK更新

    编辑:
    当前版本的Pushe正在使用android支持库。如果您打算使用AndroidX,请确保启用jettifier以进行运行时转换