Android Studio错误:Failed to resolve: com.github.zhpanvip:BannerViewPager:latestVersion

报错原因是找不到这个依赖

解决方法

1、添加仓库,我加粗的那两句话。

buildscript {
    repositories {
        // 以下四行添加阿里云的仓库地址,方便国内开发者下载相关插件
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/google'}
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}
        maven { url 'https://maven.aliyun.com/repository/public'}
        google()
//        jcenter()
        maven { url 'https://jitpack.io' }
        
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        // 以下四行添加阿里云的仓库地址,方便国内开发者下载相关插件
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/google'}
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}
        maven { url 'https://maven.aliyun.com/repository/public'}
        google()
//        jcenter()
        maven { url 'https://jitpack.io' }
        
    }
}

 

2、添加依赖——这样插入是错误的。将latestVersion改为最近的版本号

implementation 'com.github.zhpanvip:bannerviewpager:latestVersion'

正确写法

    implementation 'com.github.zhpanvip:bannerviewpager:3.5.4'

 

posted on 2021-11-09 09:12  迷途行者  阅读(1099)  评论(0编辑  收藏  举报

导航