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'

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM