Update "compile" in Android Studio

1

I'm starting with the creation of android applications, I had previously entered a course where we made applications for android, try to open one of the exercises to practice more but when I opened it I found errors of Gradle , this compilations and its versions.

How can I update the compilations?

I have several compiles and they make mistakes, and although I give it in install repository and sync project it does not do anything and the problem persists

and this is the build version I have and the targetSDKVersion

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "mx.com.dtss.carritocompras"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
    
asked by Cesar Gutierrez Davalos 31.07.2017 в 04:59
source

2 answers

1

If your build.gradle file is the one you have set, the error that marks you is that you have to add the dependencies, here I leave a page where it shows you what they are:

link

I'll give you an example of a build.gradle file mio:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "net.android.app"
    minSdkVersion 15
    targetSdkVersion 21
    versionCode 10       
    versionName "1.9"  
}
buildTypes {
    debug {
        debuggable true
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('org.simpleframework:simple-xml:2.7.1') {
        exclude module: 'stax'
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'xpp3', module: 'xpp3'
    }
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.google.android.gms:play-services-maps:9.4.0'
    compile 'com.google.android.gms:play-services-location:9.4.0'
    compile 'com.android.support:support-v4:21.0.3'
    compile 'com.androidplot:androidplot-core:0.9.8'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1'
    compile 'joda-time:joda-time:2.9.4'
}

After the buildTypes it is where you indicate the "packages" that you are going to use and that you have to download, which is what fails you. I use the ones I need, you'll have to find yours.

One of your mistakes says:

Failed to resolve: com.android.support:appcompat-v7:25.3.1

You will have to write the corresponding compile to download that library, as I use 7.21.03 I have to put this:

compile 'com.android.support:appcompat-v7:21.0.3'
    
answered by 03.08.2017 в 08:25
0
  

How can I update the compilations?

What is required are dependencies and one option is simply to click on the links, in this way you would install the necessary dependencies defined in your build.gradle :

Do not forget to synchronize your project with the files gradle again.

    
answered by 31.07.2017 в 23:54