Не удалось разрешить: com.android.support:design-v7:27.1.1 - PullRequest
0 голосов
/ 05 июля 2018

Я использую Android Studio 3.1.3. Синхронизация сборки Gradle не удалась. Я использовал следующий метод, но он бесполезен. Если есть какое-либо решение, пожалуйста, скажите мне

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

  2. Неверный перезапуск и кеши

  3. multiDexEnabled true

  4. Добавление mavenLocal() и mavenCentral()

    Это уровень модуля build.gradle file:

    android {
            compileSdkVersion 27
            defaultConfig {
                applicationId "com.developers.a_g.designapp"
                minSdkVersion 15
                targetSdkVersion 27
                buildToolsVersion '27.1.1'
                versionCode 1
                versionName "1.0"
                multiDexEnabled true
                testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            }
            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                }
            }
        }
    
    dependencies {
        implementation fileTree( dir: 'libs',include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support.constraint:constraint-layout:1.1.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        implementation 'com.android.support:cardview-v7:27.1.1'
        implementation 'com.android.support:design-v7:27.1.1'
        implementation 'com.rengwuxian.materialedittext:library:2.1.4'
        implementation 'com.szagurskii:patternedtextwatcher:0.5.0'
        implementation 'com.github.d-max:spots-dialog:0.7@aar'
        implementation 'com.squareup.retrofit2:retrofit:2.3.0'
        implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    }
    
    
     android {
            compileSdkVersion 27
            defaultConfig {
                applicationId "com.developers.a_g.designapp"
                minSdkVersion 15
                targetSdkVersion 27
                buildToolsVersion '27.1.1'
                versionCode 1
                versionName "1.0"
                multiDexEnabled true
                testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            }
            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                }
            }
        }
    
    dependencies {
        implementation fileTree( dir: 'libs',include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support.constraint:constraint-layout:1.1.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        implementation 'com.android.support:cardview-v7:27.1.1'
        implementation 'com.android.support:design-v7:27.1.1'
        implementation 'com.rengwuxian.materialedittext:library:2.1.4'
        implementation 'com.szagurskii:patternedtextwatcher:0.5.0'
        implementation 'com.github.d-max:spots-dialog:0.7@aar'
        implementation 'com.squareup.retrofit2:retrofit:2.3.0'
        implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    }
    

Это уровень проекта build.gradle файл:

    buildscript {

        repositories {

            jcenter()
            google()


            maven {
                url "https://maven.google.com"
            }
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.3'
        }
    }

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

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

Ответы [ 6 ]

0 голосов
/ 24 января 2019

Обновление до Android Studio 3.3 уничтожило все мои проекты.

Это была одна из проблем, с которой я столкнулся сегодня. И после того, как вы потратили слишком много времени, чтобы найти решение, вот рабочий грейдер. К тому времени, как я это исправил, я забыл, над чем я на самом деле работал. Мне действительно интересно, почему Google всегда поставляет свою Android Studio с испорченными файлами Gradle. Похоже, что инженеры Google даже сами не знают, как написать правильный gradle, и никто не проверял Android Studio до ее окончательного выпуска.

Модуль уровня грейдера:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27

    defaultConfig {
        applicationId "com.journaldev.okhttp"
        minSdkVersion 25
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:design:27.1.1'
    testImplementation 'junit:junit:4.12'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
}

И уровень проекта gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

        // 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/' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
0 голосов
/ 22 января 2019

это правильная форма
реализация 'com.android.support:design:27.1.1'

0 голосов
/ 05 июля 2018

Добавьте URL maven во все проекты, а также синхронизируйте gradle или попробуйте удалить внешние библиотеки по одной и синхронизировать, надеясь, что это поможет

allprojects { repositories { google() jcenter()maven :"http://www.google.com" } }
0 голосов
/ 05 июля 2018

Сначала убедитесь, , что вы используете:

targetSdkVersion 27
compileSdkVersion 27
buildToolsVersion '27.0.3'

И ваш градл будет как:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        //..
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'

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

allprojects {
    repositories {
        google()
        //..
    }
}

А также обновить реализацию проекта, как показано ниже:

implementation 'com.android.support:design:27.1.1'

Вы получаете эту ошибку, потому что com.android.support:design-v7 не существует, он существует без -v7, также вы можете проверить библиотеки поддержки по этой ссылке в любое время, чтобы убедиться, что вы используете правильная библиотека.

0 голосов
/ 05 июля 2018

Не

 implementation 'com.android.support:design-v7:27.1.1'
 buildToolsVersion '27.1.1'

У

implementation 'com.android.support:design:27.1.1'
buildToolsVersion '27.0.3'

Убедитесь, что вы добавили ниже

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

        }
    }

Тогда Clean-Rebuild-Build.

0 голосов
/ 05 июля 2018

Вы должны добавить google() хранилище к вашим зависимостям

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