Method 'Android.Support.CustomTabs.CustomTabsIntent.LaunchUrl' not found

Viewed 948

Trying to use Microsoft.Identity.Client v1.1.0-preview to authenticate users via Microsoft. When I execute App.IdentityClientApp.AcquireTokenAsync, even with a try/catch around it, it terminates the app.

The android device log shows

Info 6756 MonoDroid System.MissingMethodException: 
  Method 'Android.Support.CustomTabs.CustomTabsIntent.LaunchUrl' not found.
  at Android.App.Activity.n_OnResume (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <e975227ac8644a30bb0866117325de0d>:0 
  at (wrapper dynamic-method) System.Object:40d0e467-e2e5-447f-a0b5-87cb60ce49a7 (intptr,intptr)  

If you try to just build in Release mode, it won't. It has a similar error in the output window.

Mono.Linker.MarkException: 
Error processing method: 'System.Void Microsoft.Identity.Client.AuthenticationActivity::OnResume()' in assembly:
 'Microsoft.Identity.Client.dll' ---> Mono.Cecil.ResolutionException: 
  Failed to resolve System.Void
  Android.Support.CustomTabs.CustomTabsIntent::LaunchUrl(Android.App.Activity,Android.Net.Uri)

Does anyone know if they have just abandoned this code, or better yet, any idea how to make it work? It use to work for iOS, but now even that has some issues after the login process is complete.

1 Answers

I recently had a bad experience with Microsoft.Identity.Client on Android, please pay attention to the next things:

  • Use the latest nightly build instead of preview version
  • Ensure you meet all the requirements: Android Lollipop+ & Google Chrome is installed
  • Follow the official guide carefully
  • Follow the github project page, I found most of the solutions there

It seems like there is a problem with a custom URL scheme in the manifest, so I would recheck it first.

Related