NullPointerException after updating app with msal from 1.4.0 to 1.5.1 and enabled proguard
See original GitHub issueNullPointerException: Attempt to invoke virtual method ‘java.lang.String com.microsoft.identity.common.internal.dto.AccountRecord.getHomeAccountId()’ on a null object reference
Smartphone
- Pixel 3 Xl, android 10, WEB VIEW, msal 1.5.1, obfuscation is ON
Stacktrace
E/AndroidRuntime: FATAL EXCEPTION: main
Process: PID: 22613
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.microsoft.identity.common.internal.dto.AccountRecord.getHomeAccountId()' on a null object reference
at com.microsoft.identity.client.AccountAdapter$HomeAccountFilter.filter(AccountAdapter.java:82)
at com.microsoft.identity.client.AccountAdapter.filterCacheRecords(AccountAdapter.java:351)
at com.microsoft.identity.client.AccountAdapter.adapt(AccountAdapter.java:153)
at com.microsoft.identity.client.SingleAccountPublicClientApplication.getAccountFromICacheRecordList(SingleAccountPublicClientApplication.java:515)
at com.microsoft.identity.client.SingleAccountPublicClientApplication.getPersistedCurrentAccount(SingleAccountPublicClientApplication.java:479)
at com.microsoft.identity.client.SingleAccountPublicClientApplication.acquireTokenSilentAsync(SingleAccountPublicClientApplication.java:603)
at x.a.a.e.q.a$h$a.a(AuthorizationRepository.kt:56)
at x.a.a.e.q.a$h$a.accept(AuthorizationRepository.kt:29)
at m.b.i0.d.f.a(ConsumerSingleObserver.java:62)
at m.b.i0.e.f.m$a.a(SingleDoOnSuccess.java:60)
at m.b.i0.e.f.b$a.a(SingleCreate.java:67)
at x.a.a.e.k.a$a$a.onCreated(AzureB2CConfig.kt:44)
at com.microsoft.identity.client.PublicClientApplication$11.onCreated(PublicClientApplication.java:978)
at com.microsoft.identity.client.PublicClientApplication$9.onTaskCompleted(PublicClientApplication.java:906)
at com.microsoft.identity.client.PublicClientApplication$9.onTaskCompleted(PublicClientApplication.java:894)
at com.microsoft.identity.common.internal.controllers.CommandDispatcher$3.run(CommandDispatcher.java:212)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
To Reproduce
- Login into app with msal 1.4.0 (Single mode, webview)
- Update msal to 1.5.1
- Install app update
- run acquireTokenSilentAsync for loginApplication
Expected behavior No crash, success in acquireTokenSilentAsync
Actual Behavior App crashed
Additional context Does not repro on debug build without obfuscation
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
NullPointerException with proguard - android - Stack Overflow
I'm using Proguard with my apps and I'm getting NullPointerExceptions sent to my Developer Console for random users. When I do a ReTrace,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kreedula any updates with it? We could catch this exception and manually logout this user but i don’t really like those solution and don’t want to do it)
@azakharenka1 I believe you may have found a documentation gap for us. Thank you for that, we will work to correct it and apologies for the inconvenience caused.
The possible reason you may be facing this problem is because B2C registered applications need to be used in conjunction with MultipleAccountPublicClientApplication and not SingleAccountPublicClientApplication.
Attaching the link to the resource for implementation details.
https://docs.microsoft.com/en-us/azure/active-directory/develop/single-multi-account#multiple-account-public-client-application
Please let us know if you encounter similar errors after doing the mentioned fix.