Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

[Bug] Erro ao atualizar o compose

Pessoal, boa noite! Eu tenho um projeto em andamento e cai na besteira de atualizar o android para o compose, ocorre que agora da o erro abaixo, não encontrei o problema para corrigir e não sei o que fazer. Alguém consegue me apoiar? Eu conferi a versão no gradle e esta a 33, não entendo o porque do erro.

  1. Dependency 'androidx.navigation:navigation-common:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34.

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

  2. Dependency 'androidx.navigation:navigation-runtime:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34.

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

  3. Dependency 'androidx.navigation:navigation-fragment:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34.

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

  4. Dependency 'androidx.navigation:navigation-ui:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34.

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

  5. Dependency 'androidx.activity:activity-ktx:1.8.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34.

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

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

    :app is currently compiled against android-33.

    Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34.

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

2 respostas
solução!

Olá, Simone.

Tudo bem?

Entendo que você está enfrentando um problema ao atualizar o Android para o Jetpack Compose. O erro que você está recebendo indica que algumas dependências do seu projeto requerem que ele seja compilado com a versão 34 ou posterior das APIs do Android, enquanto o seu projeto está sendo compilado com a versão 33.

A recomendação é tentar atualizar o compileSdk do seu projeto para pelo menos a versão 34. Isso permitirá que você utilize as versões mais recentes das bibliotecas e APIs do Android.

Para fazer essa atualização, você pode seguir os seguintes passos:

  1. Abra o arquivo build.gradle do seu projeto.
  2. Procure pela linha que contém compileSdkVersion e verifique qual é a versão atualmente definida.
  3. Altere o número da versão para 34 ou superior. Por exemplo: compileSdkVersion 34.
  4. Salve o arquivo e sincronize o projeto.

Após realizar essas alterações, o seu projeto deve ser compilado com a versão correta das APIs do Android e o erro que você está enfrentando deve ser resolvido.

Lembrando que é importante verificar se todas as suas dependências são compatíveis com a versão do compileSdk que você escolheu. Caso alguma dependência não seja compatível, você pode tentar atualizá-la para uma versão mais recente que seja compatível com a versão 34 do compileSdk.

Espero ter ajudado! Se tiver mais alguma dúvida, é só me dizer. Bons estudos!

Renan, boa noite!!

muito obrigada .. segui o que vc falou e deu tudo certo.

Perdoe a demora!!

Me ajudou muito

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software