Android: ОШИБКА: не удалось найти com.android.support:appcompat-v7:28.0.0 - PullRequest
0 голосов
/ 21 октября 2018

Это расстраивает, когда вы делаете все, что предлагает Android Studio, и по-прежнему получаете ошибки, когда недостаточно того, что делать.Я пересматриваю проект и работаю на Android Studio 3.3 beta 1. После применения предложенных обновлений файл gradle приложения выглядит следующим образом:

    apply plugin:'com.android.application' 
android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3' 
    defaultConfig { 
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    testOptions {
        unitTests.returnDefaultValues = true
    }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'com.android.support:gridlayout-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'com.github.bumptech.glide:glide:4.4.0'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation "com.google.android.gms:play-services-gcm:16.0.0"
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-places:16.0.0'
    testImplementation 'junit:junit:4.12'

    implementation 'com.google.android.apps.muzei:muzei-api:2.0'
} 
apply plugin: 'com.google.gms.google-services'

enter image description here

Когда я захожу в SDK Manager, все установлено:

enter image description here

И в gradle.build:

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.3.0'
    }
}

Что я должен делать?любые предложения приветствуются.

1 Ответ

0 голосов
/ 21 октября 2018

Вам не хватает части вашего файла build.gradle верхнего уровня.Оно должно напоминать:

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

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

В частности, вам не хватает замыкания allprojects, которое устанавливает репозитории для разрешения зависимостей в каждом из модулей.В результате файл build.gradle вашего модуля не знает, где искать эти зависимости.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...