[英]Android Studio - Gradle plugin missing from offline maven repository
[英]My Android Studio Gradle is not getting the plugin from maven central
我试图将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 {
}
}
为我工作。 您应该发布更多build.gradle脚本(特别是尝试将mavenCentral()放入脚本中的方式),但是要点是您需要在脚本中的android {}块之外添加以下内容(并且除了buildscript {}块中的类似代码之外):
buildscript {
// ...
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}
android {
// ...
}
然后与Gradle重新同步您的项目。
使用此方法:
compile 'com.github.castorflex.smoothprogressbar:library:0.5.2@aar'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.