Android Studio3.5版本后依赖 maven { url 'https://jitpack.io' } 无法下载GitHub上依赖库的问题

本文解决Android Studio 3.5版本后遇到的从GitHub导出依赖库的问题,通过修改JitPack地址前缀添加“www”,实现正常下载。
repositories {
        maven {
            url 'http://maven.aliyun.com/nexus/content/groups/public/'
        }
        mavenCentral()
    }

很熟悉的依赖问题,没有VPN的情况下,都知道翻墙下载依赖库几乎都是失败告终,所以都把地址指向国内阿里云的镜像仓库,下载速度会快一些。但是依赖到:maven { url "https://jitpack.io" },几乎都是依赖GitHub上的库,GitHub能正常访问,项目库也能正常查看,但是在AS里面却无法导下来,是不是很郁闷,博主也是花了不少时间去查了,也跟GitHub上的依赖配置对比了下,几乎没问题.....

allprojects {
    repositories {
        maven {
            url 'http://maven.aliyun.com/nexus/content/groups/public/'
        }
        mavenCentral()
        maven { url "https://jitpack.io" }
    }
}

在做对比后,发现是AS 3.5版本后的问题,需要把地址校正一下:把maven { url "https://jitpack.io" }  改在maven { url "https://www.jitpack.io" },也就是添加 www,项目就能正常从GitHub上导出了,记录一下逝去的时间...

allprojects {
    repositories {
        maven {
            url 'http://maven.aliyun.com/nexus/content/groups/public/'
        }
        mavenCentral()
//        maven { url "https://jitpack.io" }
        maven { url "https://www.jitpack.io" }//android studio3.5版本以后添加www开头才能下载github上的依赖库
    }
}

 

initVersions(file("project-versions.json")) // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { extra.apply { set("kotlin_version", kotlin_version) set("compose_version", compose_version) } repositories { mavenLocal() //首选国外镜像加快github CI google() mavenCentral() maven("https://www.jitpack.io") //maven("https://120.25.164.233:8081/nexus/content/groups/public/") maven("https://maven.aliyun.com/repository/central") google { url = uri("https://maven.aliyun.com/repository/google") } mavenCentral { url = uri("https://maven.aliyun.com/repository/public") } } dependencies { classpath("com.android.tools.build:gradle:8.0.2") classpath(kotlin("gradle-plugin", version = "$kotlin_version")) classpath("com.jakewharton:butterknife-gradle-plugin:10.2.3") classpath("org.codehaus.groovy:groovy-json:3.0.8") classpath("com.yanzhenjie.andserver:plugin:2.1.12") classpath(libs.okhttp) } } allprojects { repositories { mavenLocal() //首选国外镜像加快github CI google() jcenter() mavenCentral() maven { url &#39;https://jitpack.io&#39; } maven("https://www.jitpack.io") //maven("https://120.25.164.233:8081/nexus/content/groups/public/") maven("https://maven.aliyun.com/repository/central") google { url = uri("https://maven.aliyun.com/repository/google") } mavenCentral { url = uri("https://maven.aliyun.com/repository/public") } } // tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java){ // kotlinOptions{ // freeCompilerArgs = freeCompilerArgs.toMutableList().apply { // add("-P") // add("plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true") // } // } // } } tasks.register<Delete>("clean").configure { delete(rootProject.buildDir) } Unexpected tokens (use &#39;;&#39; to separate expressions on the same line)
最新发布
11-27
Could not determine the dependencies of task &#39;:app:preDebugBuild&#39;. > Could not resolve all task dependencies for configuration &#39;:app:debugRuntimeClasspath&#39;. > Could not find com.github.youth5201314:Banner:v1.4.10. Searched in the following locations: file:/F:/AndroidStudio_SDK/extras/m2repository/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.pom file:/F:/AndroidStudio_SDK/extras/m2repository/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.jar file:/F:/AndroidStudio_SDK/extras/google/m2repository/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.pom file:/F:/AndroidStudio_SDK/extras/google/m2repository/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.jar file:/F:/AndroidStudio_SDK/extras/android/m2repository/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.pom file:/F:/AndroidStudio_SDK/extras/android/m2repository/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.jar https://dl.google.com/dl/android/maven2/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.pom https://dl.google.com/dl/android/maven2/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.jar https://repo.maven.apache.org/maven2/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.pom https://repo.maven.apache.org/maven2/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.jar https://jitpack.io/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.pom https://jitpack.io/com/github/youth5201314/Banner/v1.4.10/Banner-v1.4.10.jar Required by: project :app Possible solution: - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
09-18
评论 9
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值