gradle版本,和gradle插件版本号在7.0之后,请使用第二种方法,
如果1方法没有解决,请使用方法二。
方法一:
在做依赖build时,因为这个带来的错误;
//viewpager的导航条扩展 implementation 'com.github.hackware1993:MagicIndicator:1.5.0'
- 解决:
在repositories中加入:
maven { url "https://jitpack.io" }
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://jitpack.io"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
如果没有解决,或者报错:Received status code 502 from server: Bad Gateway;那么把maven放在jcenter()的后面;顺序也要保证;如:
maven {url "https://jitpack.io"}//放在前面,其他的maven,放在后面, maven { url 'https://dl.bintray.com/umsdk/release' }
方法二:
依赖还是原来的:
//viewpager的导航条扩展
implementation 'com.github.hackware1993:MagicIndicator:1.5.0'
不用配置build.gradle(Project),取消原来的改动;
找到项目中的:setting.gradle(Project settings)
配置:
maven {
url "https://jitpack.io"
}
如图: