Failed to execute Android studio default project: Error: Failed to execute: com.android.support:support-v4:25.2.0

I am literally just starting to develop applications for the first time and the default project when I create a new one will not build. I tried googling and SO for these errors and found some, but their solutions don't work. Considering that I haven't edited the files at all, my guess is that the problem is that Android Studio is not configured correctly, but cannot figure it out. The errors are as follows:

Error:Failed to resolve: com.android.support:support-v4:25.2.0
Install Repository and sync project
Open File
Show in Project Structure dialog

Error:(23, 24) Failed to resolve: com.android.support.test.espresso:espresso-core:2.2.2
Install Repository and sync project
Show in File
Show in Project Structure dialog

Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:26.+
Install Repository and sync project
Show in File
Show in Project Structure dialog

      

The build.gradle file it points to looks like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.extremecomputing.spotzz"
        minSdkVersion 17
        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 {
    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.google.android.gms:play-services-maps:11.0.1'
    testCompile 'junit:junit:4.12'
}

      

I tried with a previous project that created several things that I found on the internet. Such as they recommended +

in the version could cause unpredictable builds, but this was not the case. One of them recommended a few lines of compilation in the section dependencies

, he changed the errors for a moment, saying I needed to download something, I did that and it went back to the original errors. I've also tried to make sure the SDK tools are up to date and they seem to be. Any suggestions would be appreciated.

+3


source to share


3 answers


Try the following:



  • in Android Studio, open Tools -> Android -> SDK Manager
  • under the SDK Tools tab, uncheck the libraries that are causing the problem.
  • click "apply" to remove them.
  • recheck the same libraries, click apply to reinstall them.
  • close SDK manager and run Gradle sync / build
+1


source


Please note that the support library support version 25.4.0 to the latest version, we need to add google maven. As noted in the release note :

Important: Support Libraries are now available through the Google Maven Repository. You don't need to download the support repository from the SDK manager. For more information, see Configuring the Support Library.

So, you need to add google maven to root build.gradle like this:



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

      

More details in Support for library customization .

+17


source


I had the same problem and it was due to interference with another library.
In my case, I had to comment:

compile 'com.onesignal: OneSignal: [3.5.3.4.0.0)

Now he's building

0


source







All Articles