Auth0 Home Blog Docs

Auth0.OidcClient.Android 2.4, I getting Android.Util.AndroidRuntimeException: Calling startActivity() from outside

Works on Android 8.1. But doesn’t work on 9.0, 6.0 etc.

When I upgraded from v2.3.1 of the .Net nuget package for Xamarin to ver 2.4 I get an exception “Android.Util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?” when calling LoginAsync

  • Which SDK does this apply to? “Auth0.OidcClient.Android”
  • Which verison of the SDK you are using? 2.4
  • Which version of the platform are you facing this error on? .Net, Xamarin 3.6 - 4.0
  • Was this code working before? Have you made any changes in the dashboard recently? Works fine on build 2.3.1 of the SDK
  • Please capture and attach the stacktrace, it helps a lot!
 0xFFFFFFFFFFFFFFFF in System.Diagnostics.Debugger.Mono_UnhandledException_internal	C#
 0x1 in System.Diagnostics.Debugger.Mono_UnhandledException at /Users/builder/jenkins/workspace/xamarin-android-d16-1/xamarin-android/external/mono/mcs/class/corlib/System.Diagnostics/Debugger.cs:122,4	C#
 0x20 in Android.Runtime.DynamicMethodNameCounter.50	C#
 0x12 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw at /Users/builder/jenkins/workspace/xamarin-android-d16-1/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:155,13	C#
 0x6 in System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0 at /Users/builder/jenkins/workspace/xamarin-android-d16-1/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1023,49	C#
 0xC in Android.App.SyncContext. at /Users/builder/jenkins/workspace/monodroid-multibranch_d16-1/monodroid/external/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:35,19	C#
 0xE in Java.Lang.Thread.RunnableImplementor.Run at /Users/builder/jenkins/workspace/monodroid-multibranch_d16-1/monodroid/external/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36,6	C#
 0xA in Java.Lang.IRunnableInvoker.n_Run at /Users/builder/jenkins/workspace/monodroid-multibranch_d16-1/monodroid/external/xamarin-android/src/Mono.Android/obj/Release/android-28/mcw/Java.Lang.IRunnable.cs:81,4	C#
 0x11 in Android.Runtime.DynamicMethodNameCounter.50	C#
  • Please share the code that is causing the error.
    Auth0Client.LoginAsync(new { audience = AuthenticationConfig.Audience })

Please do the needful.