Upgrade Android API level to 34 on React Native

Ats
4 min readAug 17, 2024

--

This is the note about what I did to upgrade the Android API level to 34 on React Native with Expo

Photo by Ben Griffiths on Unsplash

First of all

I use Expo to develop the React Native app and Fastlane to deploy a new app. The error messages in this article came from the Fastlane deployment.

Background

I work on a React Native project with Expo and got a notification at the beginning of the last month from the Google Play Console like the one below.

I usually don’t touch the upgrade task soon to see how others do. Then it was 2 weeks before the due date. I started to work on the task.

What I did

First of all, I upgrade the compile SDK and target SDK version to 34 in the android/build.gradle file. I usually make the both versions same. If you want, I think we can use different versions for each SDK from the following discussion.

Then I tried to upload the new version to Google Play Console and I got the following error.

> Task :app:mergeExtDexDebug FAILED
ERROR:D8: com.android.tools.r8.kotlin.H

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform play-services-measurement-api-22.0.0.aar (com.google.android.gms:play-services-measurement-api:22.0.0) to match attributes {artifactType=android-dex, asm-transformed-variant=debug, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: /Users/ats/.gradle/caches/transforms-3/[...]/transformed/jetified-play-services-measurement-api-22.0.0-runtime.jar.
> Error while dexing.

I googled the error but I didn’t find any right answers for it. So I decided to follow the discussions on GitHub below. They aren’t the exact same situation, one of them is about flutter, as mine. However, the error message is the same as mine and the solutions for both are the same to each other.

So based on the discussions, I upgraded the min SDK version to 24 and tried again. Then the error had gone. However, I got another error like below.

[14:42:10]: fastlane finished with errors

[!] Google Api Error: Invalid request - You must let us know whether your app uses any full-screen intent permissions

I googled the full-screen intent permission quickly and found the following web pages.

From the web pages, the full-screen intent permission is activated by default from the Android API level 34 and we came to need to declare the usage on the Google Play Console. So that’s why the error appeared.

Also, I used notifee package to customize notifications and I found it added the full-screen intent permission automatically.

In my use case, I don’t use the full-screen notification. So I just removed the permission from the AndroidManifest.xml following comment on GitHub.

Afterward, I succeeded in uploading a new app, and the error message on the Google Play Console had gone after the review was passed.

That’s it!

--

--

Ats
Ats

Written by Ats

I like building something tangible like touch, gesture, and voice. Ruby on Rails / React Native / Yocto / Raspberry Pi / Interaction Design / CIID IDP alumni

Responses (1)