Android studio inconsistent informations, suggestions, and upgrades
Asked Answered
S

2

22

Every time I need to make upgrades in Android studio I face problems. Here is the last one (gradle 8.1.0, SDK 33, target and compile versions to 33, all installed and working fine).

The inspection now gives me

Not targeting the latest versions of Android

I then change both targetSdkVersion and compileSdk to 34, and then says (after a gradle error in inspection):

It looks like you just edited the targetSdkVersion from 33 to 34 in the editor. Be sure to consult the documentation on the behaviors that change as result of this. The Android SDK Upgrade Assistant can help with safely migrating.

I then run the Android SDK Upgrade Assistant, and says nothing about the upgrade to 34.

Still, my project builds with target 34. Yet, Build tells me:

You are strongly encouraged to update your project to use a newer Android Gradle plugin that has been tested with compileSdk = 34.

I then try to upgrade gradle by running the AGP upgrade assistant and it says gradle 8.1 is up to date, despite the fact that there is already a gradle 8.2.1.

It is quite hard to use Android Studio in a productive way.

What am I doing wrong? How can I handle all these inconsistencies? Should I wait for the software to warn me about certain updates outside the inspection?

EDIT

A second problem, even staying with 33:

Inspection gives me:

A newer version of androidx.appcompat:appcompat than 1.7.0-alpha02 is available: 1.7.0-alpha03

I change to alpha03, try to build and then it fails giving:

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

Yet it does not allow me to upgrade to 34... The only solution I found was to stay with the old alpha02 and ignore the inspection.

Soft answered 5/8, 2023 at 17:25 Comment(2)
Facing same issues, looks like a bug with Android StudioEdna
Unfortunately, time to time we have to deal with Google un-engineered and funny decision.Berneta
C
2

My guess is the upgrade assistant doesn't quite know how to update your project in the current version of Android Studio. I've been running into the exact same issue and have tried many things.

I found a few known issues with Gradle 8.3 that could possibly negatively affect those who update (see below), but there doesn't seem to be any known issues with 8.2.1 so my guess is we just need to wait for a future update to android studio which will contain updates to the Upgrade Assistant. Sorry I couldn't be of more help.

https://docs.gradle.org/8.3/release-notes.html

Cockatrice answered 20/8, 2023 at 2:10 Comment(1)
Actually, it is helpful. I arrived to the same conclusion. I upgraded to API34 without upgrading Gradle 8.1.0.Soft
P
0

I'm currently changing the target sdk from 33 to 34 in my project. After reading the Android SDK Upgrade Assistant, I see the last step (#12) is:

Once you've finished migrating your code, update targetSdkVersion to 34.

In conclusion, all the steps inside the assistant are a checklist that u should look before changing manually the targetSdkVersion, but in the end, u have to change it manually from 33 to 34...Just ignore the messages.

Paff answered 23/7 at 15:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.