AppAuth-Android: android.content.ActivityNotFoundException: When app opened
Checklist:
- I am using the latest release
- I searched for existing GitHub issues
- I read the documentation
Configuration
- Version: 0.11.1
- Integration: Java/Kotlin
Issue Description
Get this exception on Crashlytics when app is opened
Caused by android.content.ActivityNotFoundException:
at net.openid.appauth.AuthorizationService.prepareAuthorizationRequestIntent(AuthorizationService.java:555)
at net.openid.appauth.AuthorizationService.getAuthorizationRequestIntent(AuthorizationService.java:390)
at login.utils.LoginHelper.doAuth(LoginHelper.java:131)
at login.utils.LoginHelper.startAuth(LoginHelper.java:112)
at login.view.LoginHomeActivity.startAuth(LoginHomeActivity.kt:196)
at login.view.LoginHomeActivity.initView(LoginHomeActivity.kt:118)
at baseclass.BaseActivity.onCreate(BaseActivity.kt:42)
at android.app.Activity.performCreate(Activity.java:8591)
at android.app.Activity.performCreate(Activity.java:8570)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4150)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4325)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 4
- Comments: 18
The problem still exists… Does someone have new insights, why this is happening? In our case it’s only Samsung Android 13. Do other vendor implementations, which were initially forked from appauth, have solutions and workarounds others than using WebViews?
Yes, I agree. Many of our users experienced this issue, so I had to do workaound for them only.
Sorry, I can’t provide code as it isn’t open source. But the main idea is to use webview instead of browser. And I could confirm that this workaround solves this issue(it might not work if auth provider doesn’t support webview).
As a workaround, I created an authentication WebView that opens when an ActivityNotFoundException is thrown. I use
AuthorizationRequestto load URL in webview and I createAuthorizationResponseto return result. So handling result is the same implementation for webview and browser.I haven’t reproduced this error, but I believe it would work, because no need to open external browser when using internal webview.