Open Faizan-sts opened 3 years ago
Hello @Faizan-sts ,
As @clragon mentioned in issue #11 , you may find your solution here
You mentioned adding a proguard rule above, which is half of the solution.
To save you the click, @clragon suggests having both of these rules, which solved my issue:
-keep class com.microsoft.** { *; }
-keep class com.gbwisx.msal_mobile.** { *; }
The first stopped the crashing, and the second stopped the NoSuchMethodError
s for me.
I've a simple app that generates pin for authentication. It has two views, First login screen with a login button and Second view simply shows the pin.
I'm using msal_mobile to authenticate user which redirects the control to Microsoft Authentication view and once authenticated the pin screen shows up. That's it.
Problem Is
I'm getting following error when pressing 'SignIn' button.
adb Logs
````bash 01-27 00:24:12.030 7107 10824 E flutter : [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: type '_AssertionError' is not a subtype of type 'Ca' in type cast 01-27 00:24:12.030 7107 10824 E flutter : Warning: This VM has been configured to produce stack traces that violate the Dart standard. 01-27 00:24:12.030 7107 10824 E flutter : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 01-27 00:24:12.030 7107 10824 E flutter : pid: 7107, tid: 10824, name 1.ui 01-27 00:24:12.030 7107 10824 E flutter : isolate_dso_base: 7e2b0c7000, vm_dso_base: 7e2b0c7000 01-27 00:24:12.030 7107 10824 E flutter : isolate_instructions: 7e2b0d6000, vm_instructions: 7e2b0c9000 01-27 00:24:12.030 7107 10824 E flutter : #00 abs 0000007e2b2d890b virt 000000000021190b _kDartIsolateSnapshotInstructions+0x20290b 01-27 00:24:12.030 7107 10824 E flutter : #01 abs 0000007e2b0f7e23 virt 0000000000030e23 _kDartIsolateSnapshotInstructions+0x21e23 01-27 00:24:12.030 7107 10824 E flutter : #02 abs 0000007e2b26d303 virt 00000000001a6303 _kDartIsolateSnapshotInstructions+0x197303 01-27 00:24:12.030 7107 10824 E flutter : #03 abs 0000007e2b0ed5b7 virt 00000000000265b7 _kDartIsolateSnapshotInstructions+0x175b7 01-27 00:24:12.030 7107 10824 E flutter : #04 abs 0000007e2b2ef353 virt 0000000000228353 _kDartIsolateSnapshotInstructions+0x219353 01-27 00:24:12.030 7107 10824 E flutter : #05 abs 0000007e2b0ee3ef virt 00000000000273ef _kDartIsolateSnapshotInstructions+0x183ef 01-27 00:24:12.030 7107 10824 E flutter : #06 abs 0000007e2b26d813 virt 00000000001a6813 _kDartIsolateSnapshotInstructions+0x197813 01-27 00:24:12.030 7107 10824 E flutter : #07 abs 0000007e2b26d77b virt 00000000001a677b _kDartIsolateSnapshotInstructions+0x19777b 01-27 00:24:12.030 7107 10824 E flutter : #08 abs 0000007e2b2d8473 virt 0000000000211473 _kDartIsolateSnapshotInstructions+0x202473 01-27 00:24:12.030 7107 10824 E flutter :Don't know where's
<optimized out>
method coming from but It seems like themsalAuth.handleSignIn
gets called when it's not initialised. Although app works fine if i don't obfuscate the build likeflutter build apk --release --no-shrink
. But I'm running into this problem now if Obfuscate the build likeflutter build apk --obfuscate --split-debug-info=/<directory>
.As you can see i've
msalAuth
&isUserSignedIn
properties in main. I'm trying to initialiseMsalAuth
class in main'sinitState()
mehtod. And then passingmsalAuth.handleSignin
function reference to loginScreen. Which should be called on pressing SignIn button.main.dart
Login Screen
MsalAuth
I'd like to add, before i bump into this issue, obfuscating the build was crashing the app on the startup on physical device. I got over it by adding
-keep class com.microsoft.identity.** { *; }
in to my proguard-rules.pro file. Now app doesn't crash on start but thisNoSuchMethodError
is being thrown.Am i missing something to add further into my proguard rules ? As like i said before, the app works on physical device if i create a fat .apk
pubspec.yaml