2

I have an react-native app which I am trying to upgrade to use Android API level 33 as per the latest Android release requirements.

In my manifest, my app builds and runs if I have the following settings:

buildToolsVersion   = "33.0.0"
minSdkVersion       = 23
compileSdkVersion   = 33
targetSdkVersion    = 32
ndkVersion          = "23.1.7779620"

However, if I literally only change the targetSdkVersion to 33, my app builds successfully but fails to launch with the error:

Starting: Intent { cmp=com.myapp.debug/com.myapp.MainActivity }
Error type 3
Error: Activity class {com.myapp.debug/com.myapp.MainActivity} does not exist.

I can launch my app manually from within the emulator but I am wondering how to fix this launch issue. The activity name com.myapp.debug/com.myapp.MainActivity is correct. I can't see anything in particular in logcat.

Note: I have tried cleaning the build, deleting the build directory, restarting the emulator / Android Studio, clearing the gradle cache, invalidating the caches within Android Studio, uninstalling the app via adb and the emulator but with no success. If I downgrade the targetSdkVersion back to 32 everything immediately works again.

Any help / ideas would be much appreciated!

Umbungu
  • 945
  • 3
  • 10
  • 30

1 Answers1

0

If you are using Expo, there is a fix related to target SDK 33 (Fix deviceName exception on android sdk > 31). Check which version you are on or make this change in the expo-device package (with patch-package):

Change it

"deviceName" to Settings.Secure.getString(mContext.contentResolver, "bluetooth_name")

To this

"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)
},
marcelo
  • 1
  • 2