gpt4 book ai didi

android - 添加特定的存储库以构建文件

转载 作者:行者123 更新时间:2023-12-03 05:01:11 25 4
gpt4 key购买 nike

问题:我想将该library包括到我的项目中。当我添加依赖项时,我得到:

Failed to resolve: com.github.glomadrian:loadingballs1.1



问题:我必须如何更改gradle文件才能解决该问题?我认为这与添加存储库Maven有关。如果是这样,我该在哪里正确放置呢?

注意:我发现了 post似乎可以回答我的问题,但不幸的是我仍然遇到问题。

该库提供了一个小教程:

Add the specific repository to your build file:



他们的示例代码:
repositories {
maven {
url "https://jitpack.io"
}
}

我已经将maven存储库添加到我的构建文件中,如下所示:

build.gradle(项目)
   buildscript {
repositories {
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'

//Maven plugin
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}

}

task clean(type: Delete) {
delete rootProject.buildDir
}

build.gradle(Module:app)
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.stack.overflow"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
(...)
compile 'com.github.glomadrian:loadingballs:1.1@aar'

}

最佳答案

是的,您需要在项目build.gradle中将存储库添加到gradle配置中,如下所示:

allprojects {
repositories {
jcenter()
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
}
}

或添加到module:app build.gradle,如下所示:
apply plugin: 'com.android.application'

android {
(... your config...)
}

repositories {
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
(... more dependencies ...)
compile 'com.github.glomadrian:loadingballs:1.1@aar'

}

关于android - 添加特定的存储库以构建文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37721767/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com