0

He descargado el siguiente proyecto: Pruebas con Android-Charts y lo ejecuto perfectamente en IDE Android Studio versión Chipmunk 2021.2.1. He creado un proyecto nuevo para reproducir un solo diagrama en éste, pero los ficheros build.gradle de los proyectos y los settings.gradle son diferentes. En el build.gradle del proyecto antiguo que he descargado apunta a los siguientes repositorios:

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

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

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

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

El proyecto nuevo en el build.gradle del proyecto solo contiene:

plugins {

        id 'com.android.application' version '7.2.0' apply false
        id 'com.android.library' version '7.2.0' apply false
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }

Sin embargo, poniendo esto mismo en el nuevo da error.

En el proyecto antiguo, el fichero settings.gradle solo contiene:

 include ':app'
rootProject.name = "androidcharts"

En el proyecto nuevo el fichero settings.gradle es el que contiene las referencias a los repositorios:

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()

        maven { url 'https://jitpack.io' }
    }
}
rootProject.name = "cucu"
include ':app'

Ahí es donde incluyo: maven { url 'https://jitpack.io' } y en el build.gradle del módulo su implementación implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

Lo sincronizo perfectamente. No arroja ningún error. Pero, al ejecutarlo, arroja el siguiente error:

6 issues were found when checking AAR metadata:

  1.  Dependency 'androidx.appcompat:appcompat-resources:1.6.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.2.0 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  2.  Dependency 'androidx.appcompat:appcompat:1.6.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.2.0 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  3.  Dependency 'androidx.activity:activity:1.6.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.2.0 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  4.  Dependency 'androidx.core:core-ktx:1.9.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.2.0 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  5.  Dependency 'androidx.core:core:1.9.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.2.0 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  6.  Dependency 'androidx.annotation:annotation-experimental:1.3.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.2.0 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on). 

introducir la descripción de la imagen aquí

¿Es un problema de versiones?

1 respuesta 1

1

La solución al error que se indica es simple.

Dependency 'androidx.appcompat:appcompat-resources:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.

Varias de tus dependencias/bibliotecas necesitan como mínimo ser compiladas con Android 13 (nivel de API 33), por lo tanto, debes definir en tu archivo build.gradle el uso de este nivel de API:

compileSdkVersion 33
2
  • Como siempre, muchas gracias Jorge por tu respuesta. Sí, he podido leer en el msn de error esa recomendación. Pero me asalta una duda, ¿por qué en la app que descargas de GitHub está compilando en la versión 30 sin problemas?. PD: En el enlace de la cuestión puedes consultar que verdaderamente está compilando con la v30.
    – Chiscu
    Commented el 2 feb. 2023 a las 13:38
  • 1
    @Chiscu según los errores, estás usando versiones diferentes de las librerías a las usadas en el repositorio. Por ejemplo, appcompat 1.6.0 en tu proyecto y 1.2.0 en el repositorio. Debe ser por eso. Una versión da problemas y la otra no.
    – Mateo
    Commented el 2 feb. 2023 a las 14:38

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.