Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:Could not resolve all files for configuration ':app:debugCompileClasspath'

Tags:

android

Here is full message from log: Error:Could not resolve all files for configuration ':app:debugCompileClasspath'.

Could not find com.android.support:appcompat-v7:26.1.0. Searched in the following locations: file:/C:/Users/Anatoly/AppData/Local/Android/Sdk/extras/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom file:/C:/Users/Anatoly/AppData/Local/Android/Sdk/extras/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.jar file:/C:/Users/Anatoly/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom file:/C:/Users/Anatoly/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.jar file:/C:/Users/Anatoly/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom file:/C:/Users/Anatoly/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.jar file:/C:/android/AndroidStudio/gradle/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom file:/C:/android/AndroidStudio/gradle/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.jar Required by: project :app

My gradle-wrapper.properties

distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip

My build.gradle of project

buildscript {
    repositories {
        // Gradle 4.1 and higher include support for Google's Maven repo using
        // the google() method. And you need to include this repo to download
        // Android plugin 3.0.0 or higher.
        google()
        maven { url "https://maven.google.com" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

My build.gradle of app:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26



    defaultConfig {
        applicationId "ru.foodrobot.test2"
        minSdkVersion 10
        targetSdkVersion 26
        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'])

    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
like image 489
Anatoly Avatar asked Dec 08 '17 14:12

Anatoly


3 Answers

I modified project level /gradle.build

allprojects {
repositories {
    jcenter()

to:

allprojects {
repositories {
    jcenter { url "http://jcenter.bintray.com/"}

in files:

platforms/android/build.gradle
like image 89
RkKhanpuriya Avatar answered Oct 17 '22 01:10

RkKhanpuriya


add google() in repositories at project level and click Sync Now and error will be gone. as

build.gradle(Project:XXX)

repositories {
   google()//new 
   jcenter()
}
like image 2
user3339740 Avatar answered Oct 17 '22 00:10

user3339740


Rename the gradle.properties file to xgradle.properties and try:

ionic cordova build android --prod 

It will work fine.

like image 1
Dr NVS Avatar answered Oct 17 '22 00:10

Dr NVS