gpt4 book ai didi

android - 我的Android Studio Gradle无法从Maven Central获取插件

转载 作者:行者123 更新时间:2023-12-03 04:42:20 25 4
gpt4 key购买 nike

我试图将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重新同步您的项目。

关于android - 我的Android Studio Gradle无法从Maven Central获取插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25492649/

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