1

В Android Studio после запуска появляется ошибка в build.gradle

C:\Android\AndroidLessons\AndroidLessons\app\build.gradle
Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2
Error:(27, 13) Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2
<a href="install.m2.repo">Install Repository and sync project</a><br><a href="openFile:C:/Android/AndroidLessons/AndroidLessons/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

В build.gradle следуещее:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

Когда нажимаю Install Repository and sync project появляется ошибка All packages are not available to for doenload!

скриншот

10
  • 1
    build.gradle какая версия?
    – TimurVI
    29 янв 2018 в 8:17
  • compileSdkVersion 26 29 янв 2018 в 12:47
  • buildToolsVersion "27.0.3" 29 янв 2018 в 12:47
  • В build.gradle (Project) гляньте
    – TimurVI
    29 янв 2018 в 12:48
  • classpath 'com.android.tools.build:gradle:3.0.1' - вот так выглядит строка, номер может быть другой
    – TimurVI
    29 янв 2018 в 12:52

1 ответ 1

0

Попробуйте заменить строку

compile 'com.android.support:appcompat-v7:26.+'

на

compile 'com.android.support:appcompat-v7:27.0.2'

Если не поможет, перенесите строки

compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'

в build.gradle модуля app таким образом:

implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
2
  • Я правильно понимаю под "перенести" заменить compile на implementation или нет? Пишет Gradle DSL method not found: 'implementation()' 29 янв 2018 в 12:43
  • да. заменить compile на implementation. Но именно в build.gradle модуля, а не проекта. В build.gradle проекта - удалить
    – alex
    29 янв 2018 в 14:14

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.