After upgrading the compose bom to 2023.08.00 (so ...
# compose-android
j
After upgrading the compose bom to 2023.08.00 (so compose 1.5 stable) i have this error:
Copy code
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > 2 issues were found when checking AAR metadata:
     
       1.  Dependency 'androidx.emoji2:emoji2-views-helper:1.4.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.
     
           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 8.1.0 is 33.
     
           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 34, then update this project to use
           compileSdk of at least 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.emoji2:emoji2:1.4.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.
     
           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 8.1.0 is 33.
     
           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 34, then update this project to use
           compileSdk of at least 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).
I do not use the emoji dependency anywhere (explicitly). I feel like stable compose shouldn't force me to use beta SDK platform through transient dependency. Anybody else came across that?
plus1 1
e
I started using API 34 because of this. I think it's API stable now, so the only downside should be not having sources available (also having to migrate to API 34)
i
Correct, API 34 and the SDK reached platform stability a couple months ago: https://developer.android.com/about/versions/14/overview#platform_stability
i
And note that the Sources of API 34 were published just today: https://androiddev.social/@ianlake/110862157065161400
🎉 1
🙌 1
j
Also hit this today when trying to upgrade. This would have been good to have in the release notes, but now that the sources are available this should be an easy transition
j
Yea, it's not a major problem, but i think it should be in the release notes for compose 1.5 🙂 Thanks everybody
r
It's a bit inconvenient because it enforces using AGP 8.2.0-alpha0x+ thus Android Studio Hedgehog which is still at canary state. Either we stay with Compose BOM 2023.06.01 and composeSdkVersion=33 or we do all this BOM/canary/alpha upgrade. Nevermine it works fine :)
e
it shouldn't force AGP 8.2, my project was fine with AGP 8.0 and compileSdk=34
😮 1
j
Working for me on AGP 8.0 too, no problems
r
You're right! It must be this message I've taken as an error but is just a warning :
We recommend using a newer Android Gradle plugin to use compileSdk = 34
This Android Gradle plugin (8.1.0) was tested up to compileSdk = 33 (and compileSdkPreview = "UpsideDownCakePrivacySandbox").
You are strongly encouraged to update your project to use a newer
Android Gradle plugin that has been tested with compileSdk = 34.
If you are already using the latest version of the Android Gradle plugin,
you may need to wait until a newer version with support for compileSdk = 34 is available.
i
A warning the AGP team is going to be removing in an 8.1.1 patch release: https://issuetracker.google.com/issues/295235385
👍🏾 1
👍 1
g
Hey @Ian Lake, can you point where
compileSdk 34
requirement is coming from? I was expecting to see
minSdk
set in here. It would be good to know these constraints in advance
i
g
So if any explicit/transitive library is compiled with 34, the app has to set
compileSdk
to 34?
i
AGP does enforce that, yes - your app will crash otherwise. You should always compile with the latest SDK as per https://medium.com/androiddevelopers/picking-your-compilesdkversion-minsdkversion-targetsdkversion-a098a0341ebd
It is targetSdk that actually requires testing your app and understanding the behavior changes. compileSdk does not change any runtime behavior
g
Runtime behaviour aside, my concern is mainly around not mixing library updates. Let’s say we are updating the Compose Compiler and UI libraries to next major, and we are suddenly discovering we also need to update
compileSdk
. Which was originally planned to happen after the Compose update. (For context: Not a big deal for a single app but we have multiple apps and multiple internal libraries so library updates take more effort.) What I’m hearing is we should prioritise updating
compileSdk
first before updating other libraries. Thanks 👍
i
Yes, you're about 7 months at this point for updating your compileSdk, so I'd start there for sure
256 Views