当前位置:   article > 正文

Android Studio换国内源_android studio换源

android studio换源

最近想给女朋友写一个记录大姨妈的软件,查资料发现自带的calendarview有很大的局限性,所以用了一个github上的一个项目。

项目地址:com.haibin.calendarview

	implementation("com.haibin:calendarview:3.7.1")
  • 1

在implementation后,总会报错

Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.haibin:calendarview:3.7.1.
  • 1

后来查阅了大量的资料后,发现换源可以解决这个问题。并且从 Android Studio Dolphin 2021.3.1 之后,国内源的切换配置就从 build.gradle 文件改到了 settings.gradle 文件,maven也改了格式。

maven { url 'https://' }
改为
maven(url = "https://")
  • 1
  • 2
  • 3

settings.gradle.kts

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.name = "project"
include(":app")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

改为

pluginManagement {
    repositories {
        maven(url = "https://plugins.gradle.org/m2/")
        maven(url = "https://maven.aliyun.com/nexus/content/repositories/google")
        maven(url = "https://maven.aliyun.com/nexus/content/groups/public")
        maven(url = "https://maven.aliyun.com/nexus/content/repositories/jcenter")
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        maven(url = "https://plugins.gradle.org/m2/")
        maven(url = "https://maven.aliyun.com/nexus/content/repositories/google")
        maven(url = "https://maven.aliyun.com/nexus/content/groups/public")
        maven(url = "https://maven.aliyun.com/nexus/content/repositories/jcenter")
        google()
        mavenCentral()
    }
}

rootProject.name = "project"
include(":app")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/爱喝兽奶帝天荒/article/detail/890773
推荐阅读
相关标签
  

闽ICP备14008679号