错误:(39,13)无法解决:com.android.support:appcompat-v7:26.0.0

时间:2017-07-30 06:32:54

标签: android

我正在使用Android工作室2.3和思考支持我的应用程序中的新机器人26但是我在标题消息时遇到错误。我的gradle文件如下所示

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"



    defaultConfig {
        applicationId "com.example.shayari"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"

        manifestPlaceholders = [onesignal_app_id               : "",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]

        vectorDrawables.useSupportLibrary = true
    }



    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

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

    compile 'com.google.android.gms:play-services-location:10.2.6'
    compile 'com.android.support:support-v4:26.0.0'
    compile 'com.google.android.gms:play-services-gcm:10.2.6'
    compile 'com.google.android.gms:play-services-ads:10.2.6'
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'com.android.support:preference-v7:26.0.0'
    compile 'com.android.support:design:26.0.0'
    compile 'com.android.support:cardview-v7:26.0.0'
    compile 'com.squareup.okhttp:okhttp:2.3.0'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.android.support:customtabs:26.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'
    compile 'com.onesignal:OneSignal:[3.5.3,4.0.0)'
    compile 'com.codemybrainsout.rating:ratingdialog:1.0.7'
    compile 'com.android.support:support-vector-drawable:26.0.0'
    compile 'com.google.android.gms:play-services-auth:10.2.6'
    compile 'de.hdodenhof:circleimageview:2.1.0'
}
repositories {
    jcenter()
    flatDir {
        dirs 'libs'
    }
}

但我无法使用以下错误安装支持存储库..

Error:(39, 13) Failed to resolve: com.android.support:appcompat-v7:26.0.0
<a href="install.m2.repo">Install Repository and sync project</a><br><a href="openFile:C:/Users/MAITRII/Desktop/newhindi/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

2 个答案:

答案 0 :(得分:63)

将此添加到项目级别build.gradle文件:

repositories {
    maven {
        url "https://maven.google.com"
    }
}

答案 1 :(得分:23)

<强>更新 在Android studio 3.0中,错误得以解决 或者您可以添加google()来解决它,因为您将使用新的gradle插件here

buildscript {
    repositories {
        ...
        // You need to add the following repository to download the
        // new plugin.
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
    }
}

Android Studio 3.0之前: 检查系统中是否安装了支持库(检查系统中的SDK目录)或检查SDK Manager中是否安装了Android O.

this回答陈述

  

从支持库的第26版开始,确保存储库部分包含带有&#34; https://maven.google.com&#34;的#maven部分。端点。

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}