Skip to content

fix: resolve ActivityNotFoundException on Android 11 by declaring browser query intents#22

Closed
Copilot wants to merge 2 commits intodevelopfrom
copilot/fix-activity-not-found-exception
Closed

fix: resolve ActivityNotFoundException on Android 11 by declaring browser query intents#22
Copilot wants to merge 2 commits intodevelopfrom
copilot/fix-activity-not-found-exception

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

Android 11 (API 30) introduced package visibility restrictions — PackageManager.queryIntentActivities() returns empty results unless the app explicitly declares the intent filters it needs to query. AppAuth relies on this call to select a browser for the Custom Tabs flow, so without the declaration it finds no browser and throws ActivityNotFoundException at sign-in.

Changes

  • oneloginoidc/src/main/AndroidManifest.xml — Added <queries> block with VIEW intents for http/https schemes. As the library manifest, this is merged into any consuming app automatically.
  • app/src/main/AndroidManifest.xml / appjava/src/main/AndroidManifest.xml — Same <queries> block added directly to both demo app manifests.
<queries>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="https" />
    </intent>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="http" />
    </intent>
</queries>

<queries> is a visibility declaration only — it grants no additional permissions.

Original prompt

This section details on the original issue you should resolve

<issue_title>ActitivityNotFound Exception on Android 11</issue_title>
<issue_description>When using the demo project on Android 11 it will crash when using the signIn function due to not being able to launch a Browser.
A tag on the AndroidManifest.xml with an https scheme intent needs to be added:
https://developer.android.com/training/basics/intents/package-visibility-use-cases#check-browser-available</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: Subterrane <5290140+Subterrane@users.noreply.github.com>
Copilot AI changed the title [WIP] [ACT-123] Fix ActivityNotFound exception on Android 11 fix: resolve ActivityNotFoundException on Android 11 by declaring browser query intents Mar 17, 2026
Copilot AI requested a review from Subterrane March 17, 2026 16:28
Subterrane added a commit that referenced this pull request Mar 17, 2026
…owser query intents

Android 11 (API 30) introduced package visibility restrictions that cause
PackageManager.queryIntentActivities() to return an empty list unless the
app declares <queries> for the intents it needs. AppAuth uses this to
discover available browsers, so without the declaration the sign-in flow
crashes with ActivityNotFoundException.

This adds <queries> for VIEW intents with http/https schemes to the library
manifest (automatically merged into consumer apps). Also bumps
compileSdkVersion to 30 and AGP to 4.1.3 (both required for <queries>
element support), and updates the Gradle wrapper to 6.7.1.

Supersedes #22. [no-ado]
@Subterrane
Copy link
Copy Markdown
Collaborator

Thanks for identifying this issue — the root cause diagnosis is correct and <queries> is the right fix.

However, this PR as written won't have the intended effect because compileSdkVersion is still 29 and AGP is too old. The <queries> element requires:

  • compileSdkVersion 30+
  • AGP 4.1.0+ (the project is on 3.6.3)
  • Gradle 6.5+ (the project is on 5.6.4)

Additionally, the <queries> blocks in the demo app manifests are redundant since the library manifest is automatically merged.

I've opened PR #24 which addresses the same issue with the necessary build tooling bumps. See that PR for details.

@Subterrane
Copy link
Copy Markdown
Collaborator

#24

@Subterrane Subterrane closed this Mar 17, 2026
@Subterrane Subterrane deleted the copilot/fix-activity-not-found-exception branch March 17, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ActitivityNotFound Exception on Android 11

2 participants