【发布时间】:2014-08-25 19:00:31
【问题描述】:
我尝试将smoothprogressbar 库添加到我的android 项目中
我将这些行添加到我的 build.gradle 中
dependencies {
// of course, do not write x.x.x but the version number
compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}
当我同步 gradle 时,它会说 找不到:com.github.castorflex.smoothprogressbar:library:0.5.1
我尝试将 mavenCentral() 和 maven url 放入 build.gradle 和我在 stackoverflow 中找到的其他解决方案,但似乎没有任何效果。
已编辑:
这是我的完整 gradle 文件
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:cardview-v7:21.+'
compile('com.google.http-client:google-http-client-android:1.18.0-rc') {
exclude(group: 'com.google.android', module: 'android')
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile project(path: ':backend', configuration: 'android-endpoints')
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile project(':library')
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v4:19.+'
compile 'com.google.android.gms:play-services:4.4.52'
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v13:19.+'
compile 'com.google.code.gson:gson:2.+'
compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}
android {
signingConfigs {
...
}
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId ...
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
dexOptions {
preDexLibraries = false
}
productFlavors {
}
}
【问题讨论】:
-
您找到解决方案了吗?
-
是的,实际上,当我们将其他一些存储库添加到存储库块中时,就会出现这个问题。我在 mavenCentral() 之前添加了 jcenter() 存储库,因此我无法加载外部 maven 依赖项。从存储库块中删除该 jcenter() 后,它开始工作。检查模块中的存储库块以及主项目 build.gradle
标签: android gradle android-gradle-plugin