无法解析com.android.support:appcompat-v7:28.0.0 [英] Could not resolve com.android.support:appcompat-v7:28.0.0

查看:91
本文介绍了无法解析com.android.support:appcompat-v7:28.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对此有很多不同的问题,但是有关使用

There are many different questions about this, but the problems there are about using v7.28.0, v7.28.+, v7.28.0.0-rc02 But when I sync my project I get this error:

无法解决':app @ debug/compileClasspath'的依赖关系:可以 无法解析com.android.support:appcompat-v7:28.0.0.

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0.

我已检查支持库设置,并按照说明进行操作但这没有帮助.

I've checked Support library setup and followed it's instructions but it didn't help.

这是我的模块应用

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

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

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.mobaleghan.nasimnoor"
        manifestPlaceholders = [
                onesignal_app_id: 'b1ced87b-48d1-4857-a68b-9c287aa4003f',
                // Project number pulled from dashboard, local value is ignored.
                onesignal_google_project_number: 'REMOTE'
        ]
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 8
        versionName "1.6.3"
        vectorDrawables.useSupportLibrary = true
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }

    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:preference-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:support-annotations:27.1.1'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation "com.android.support:support-core-utils:28.0.0"
    implementation 'com.onesignal:OneSignal:3.10.3'
}

和项目gradle:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

我已经在设置中进行了测试,因此android studio的互联网连接很好,而且我不知道要看什么.

The android studio internet connection is fine as I've tested in settings and I don't know where else to look.

我什至在AS 3.2.1中创建了一个新项目,但出现相同的错误. 我不知道为什么每当我更新AS时都会发生这种情况

I even created a new project in AS 3.2.1 But I get same error. I don't know why this happens every time I update AS!

推荐答案

我确定其他答案也不错并且可以正常工作.但是我的解决方案是通过将代理设置为开发人员自由解决的.

I'm sure other answers are good and working. but mine got solved by set proxy to Freedom of Developers.

此解决方案适用于像我这样的波斯人,他们受到Google对伊朗人的严格限制.

This solution is for Persians like me who suffer from strict limitations for Iranians by google.

现在我的应用程序gradle看起来像这样:

Now my app gradle look like this:

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

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

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.mobaleghan.nasimnoor"
        manifestPlaceholders = [
                onesignal_app_id: 'b1ced87b-48d1-4857-a68b-9c287aa4003f',
                // Project number pulled from dashboard, local value is ignored.
                onesignal_google_project_number: 'REMOTE'
        ]
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 9
        versionName "1.6.4"
        vectorDrawables.useSupportLibrary = true
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }

    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:preference-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation "com.android.support:support-core-utils:28.0.0"
    implementation 'com.onesignal:OneSignal:3.10.3'
}

这些存储库都基于 OneSignal文档.

顶级构建:

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

一切正常.

这篇关于无法解析com.android.support:appcompat-v7:28.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆