Java Android如何在GitHub上搜索依赖项?
我想在我的android项目中实现GitHub的依赖项,但它给了我这个错误 找不到com.github.RobertApikyan:SegmentedControl:1.2.0 我正在实施:Java Android如何在GitHub上搜索依赖项?,java,android,kotlin,dependency-injection,build.gradle,Java,Android,Kotlin,Dependency Injection,Build.gradle,我想在我的android项目中实现GitHub的依赖项,但它给了我这个错误 找不到com.github.RobertApikyan:SegmentedControl:1.2.0 我正在实施: implementation 'com.github.RobertApikyan:SegmentedControl:1.2.0' 我认为是这样的,因为by build.gradle文件不会在GitHub上搜索repos 这是我的build.gradle文件: buildscript { ext.k
implementation 'com.github.RobertApikyan:SegmentedControl:1.2.0'
我认为是这样的,因为by build.gradle文件不会在GitHub上搜索repos
这是我的build.gradle文件:
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
解决方法1:
您可以使用github将项目发布托管到mavenCentral,它位于:
https://github.com/{user}/{repository}/packages?package_type=Maven
为了从中提取包,请在build.gradle中添加新的存储库:
mavenCentral()
maven { url 'https://jitpack.io' }
措辞2:
您可以在以下位置托管项目的任何分支或版本:
最棒的是,你不需要设置任何东西,它会在服务器上构建你的包并通知你。您的项目将位于:
https://github.com/{user}/{repository}/packages?package_type=Maven
https://jitpack.io/#{user}/{repository}
为了从中提取包,请在build.gradle中添加新的存储库:
mavenCentral()
maven { url 'https://jitpack.io' }
非常感谢。我应该再看一遍回购协议。它就站在那里哈哈“Android是如何搜索GitHub上的依赖项的?”-它没有!它会在配置的本地和远程Maven repos中搜索它们。