【发布时间】:2016-10-09 20:37:00
【问题描述】:
问题:我想将 library 包含到我的项目中。当我添加依赖项时,我得到:
无法解决:com.github.glomadrian:loadingballs1.1
问题:如何更改我的 gradle 文件才能解决问题?我认为这与添加存储库 maven 有关。如果是这样,我必须在哪里正确放置?
注意:我找到了一个post,它似乎可以回答我的问题,但不幸的是我仍然遇到了这个问题。
图书馆给出了一个小教程:
将特定的存储库添加到您的构建文件中:
他们的示例代码:
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'
}
【问题讨论】:
标签: android android-studio gradle dependencies