I have a bug that only happens on API 33. Did something change? I mean, things definitely changed, but I made all the necessary updates. Did I miss one?
I have two apps: A and B. Let's call them com.example.a and com.example.b. They need to launch each other. As of API 33, when app A tries to launch app B, I get:
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.b/com.example.b.DefaultLaunchActivity}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared <intent-filter>?
DefaultLaunchActivity is defined in app B's manifest like this:
<activity
android:name="com.example.b.DefaultLaunchActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I also added the following to app A's manifest (required as of API 31):
<queries>
<package android:name="com.example.b" />
</queries>
Finally, app A gets app B's launch Intent like this:
val intent = application.packageManager.getLaunchIntentForPackage("com.example.b")?.apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
}
Adding Intent.FLAG_ACTIVITY_REQUIRE_NON_BROWSER doesn't help. App B gets the same error when it tries to launch app A.
To be clear, the code above works on API 32 but not API 33. What changed?


Yes, many things have changed.
You have to explicitly define in the
manifestfile packages of apps you are going to call, e.g.:It was introduced in Android 11 (API 30). The observed behavior might be explained as it was introduced in API 30, but forced since API 33. Also others causes are possible. It will require more research to figure out a root cause.
Ref. Android docs: queries
Ref. Android docs: Behavior changes: Apps targeting Android 11
update I noticed you already use
queriesattribute, so an issue cause lays somewhere else