【问题标题】:Failed to resolve third party library dependencies in Gradle in Androidstudio无法在 Android Studio 中解析 Gradle 中的第三方库依赖项
【发布时间】:2016-03-02 04:22:25
【问题描述】:

当我尝试提供第三方库依赖时,它会显示

错误:(72, 13) 无法解决: com.pkmmte.view:circularimageview:1.1 在文件中显示 在项目结构对话框中显示

buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
  }
}

apply plugin: 'android'

dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:palette-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.pkmmte.view:circularimageview:1.1'
}

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
    multiDexEnabled true
}
sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }

    instrumentTest.setRoot('tests')
    debug.setRoot('build-types/debug')
    release.setRoot('build-types/release')
 }
}                             

这是我的 build.gradle。 我已将我的项目从 Eclipse 迁移到 Androidstudio。

【问题讨论】:

    标签: android eclipse gradle


    【解决方案1】:

    您的顶级 gradle 文件需要指向 maven 库源。见下文。

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.5.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            mavenLocal()
            mavenCentral()
        }
    }
    

    【讨论】:

    • 嘿,认真的工作老兄,谢谢,但我有疑问。我还将另一个项目从 eclipse 迁移到了 android studio。在那个项目中,我还添加了一些第三方库依赖项,它与 mavenCentral() 使用相同的存储库。怎么样?
    • @palanivelraghul 你是什么意思?
    猜你喜欢
    • 1970-01-01
    • 2013-12-12
    • 2015-12-19
    • 1970-01-01
    • 2019-03-31
    • 2019-08-09
    • 2015-02-23
    • 2019-06-08
    相关资源
    最近更新 更多