【问题标题】:Falied to resolve android dependencies无法解析 android 依赖项
【发布时间】:2016-06-17 19:10:23
【问题描述】:
Error:Failed to resolve: com.android.support:appcompat-v7:23.2.0

这是我在尝试编译我的 android 应用程序时遇到的错误。我查看了许多关于此问题的问题,并尝试更新我的 SDK,重新打开 Android Studio 并更改为:compile (com.android.support:appcompat-v7:+),但没有任何效果,Android Studio 仍然抱怨他无法解决它。有人知道为什么会这样吗?这是我所有的 Gradle 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'


    lintOptions {
        abortOnError false
    }

    defaultConfig {
        applicationId "com...."
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 35
        versionName "1.5"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'

    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.android.support:cardview-v7:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.google.android.gms:play-services-appindexing:8.4.0'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile project(':library')

    compile 'net.steamcrafted:materialiconlib:1.0.8'
    compile 'com.pes.materialcolorpicker:library:1.0.2'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.easing:library:1.0.1@aar'
    compile 'com.daimajia.androidanimations:library:1.1.3@aar'

    compile('de.psdev.licensesdialog:licensesdialog:1.8.0')

    compile 'com.github.paolorotolo:appintro:3.4.0'

    compile 'com.github.deano2390:MaterialShowcaseView:1.0.6'

    compile "com.oneskyapp:screenshot:0.7.4"

    compile('com.mikepenz:materialdrawer:4.6.4@aar') {
        transitive = true
    }
}

我的 sdk Extras 都安装好了:

【问题讨论】:

标签: java android gradle


【解决方案1】:

检查您的 SDK 管理器。大多数“正常”支持组件都包含在支持存储库中。 “Android 支持库”还不够。这会安装独立版本,而不是 gradle 使用的版本。

【讨论】:

  • 我用 sdk 上的附加图像编辑了我的问题。它们都已安装。
【解决方案2】:

请在下面的模式中重命名您的支持库依赖项并检查这可能会对您有所帮助。此外,它不会硬编码,而是选择最新的更新。

编译'com.android.support:appcompat-v7:$supportLibraryVersion' 编译'com.android.support:support-v4:$supportLibraryVersion'

【讨论】:

    【解决方案3】:

    如果您使用buildToolsVersion '23.0.2',请更改,然后使用

     compile 'com.android.support:appcompat-v7:23.1.1'
     compile 'com.android.support:design:23.1.1'
     compile 'com.android.support:support-v4:23.1.1'
    

    如果您想使用“23.2.0”,请完全更新您的 SDK。

    编辑

    您的 SDK 是这样的吗?如果是,请先清理您的代码并重新构建。

    【讨论】:

    • “忽略未知的包过滤器'build-tools-23.2.0'警告:包过滤器删除了所有包。没有要安装的东西。请考虑在没有包过滤器的情况下再次尝试更新。”当我尝试这样做时
    • 感谢您的快速回答,我试过了,但不知何故错误仍然相同:“错误:无法解决:com.android.support:appcompat-v7:23.2.0”,即使我的 gradle 文件中没有这样的行。
    • 好的,请检查您的 SDK 管理器,让我知道是否已安装所有软件包?
    • api 23、22、21、Tools 和 Extras 中的所有包都已安装并且是最新的。
    • @Y.Franco Ok 重启你的 Android Studio 并清理你的项目。试一试。
    【解决方案4】:

    正如你所说,你的 android studio 已经全部更新。那么出现这个问题的原因有很多...

    1..确保您在同步、重建或运行您的项目时有正确的互联网连接。因为您正在使用许多远程依赖项,例如 (compile 'com.android.support:appcompat-v7:23.2.0'),在这种情况下,gradle 会下载所有远程依赖项。

    2.. 由于您同时使用本地和远程依赖项,并且如果您在应用程序的 libs 文件夹中有任何 appcompat v7,在这种情况下,由于一个库版本兼容性,可能会出现此问题。

    // Remote binary dependency
    compile 'com.android.support:appcompat-v7:23.2.0'
    
    // Local binary dependency
    compile fileTree(dir: 'libs', include: ['*.jar'])
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-06
      • 2019-03-31
      • 2017-05-18
      • 1970-01-01
      相关资源
      最近更新 更多