Upgrading to Android API Level 33 fails to launch the main activity in the emulator – Android

by
Ali Hasan
android android-13 android-emulator android-studio react-native

Quick Fix: When using Expo, target SDK 33 may cause issues. Update the "deviceName" property in the expo-device package to support SDK levels greater than 31 by changing it to:

"deviceName" to run {
if (Build.VERSION.SDK_INT <= 31)
Settings.Secure.getString(mContext.contentResolver, "bluetooth_name")
else
Settings.Global.getString(mContext.contentResolver, Settings.Global.DEVICE_NAME)
},

Refer to the Expo documentation for more details.

The Problem:

An Android app fails to launch the main activity in the emulator after upgrading to Android API Level 33, despite having correct activity name and successful build. The error message is: "Activity class {com.myapp.debug/com.myapp.MainActivity} does not exist." Downgrading targetSdkVersion to 32 resolves the issue.

Q&A

What is the solution for Expo while upgraing to Android API Level 33?

Check the expo-device package and use patch-package to fix deviceName error.

Video Explanation:

The following video, titled "THIS Is How You Use Notifications on Android API 33+ (Notification ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

To be able to show notifications on API level 33+, users now need to accept a permission before. In this video I'll show you how to do that ...