Android SDK closes the app Activity

I am using auth0 SDK in my Android app:

com.auth0.android:lock:3.2.2

and I have code to show Universal login screen in my MainActivity below:

try {
WebAuthProvider.login(account)
.withScheme(“demo”)
.withAudience(“https://$authDomain/userinfo”)
.await(context)
.let { credentials →
if (credentials.user.isEmailVerified == false) {
return@withContext Either.Error(AuthFailure.VerificationRequired(“Please verify your email first.”))
}

                    // TODO : fetchMyAccessToken
                }
        } catch (e: AuthenticationException) {
            Timber.w("*********** webAuthLogin error: $e, isCanceled: ${e.isCanceled}, isVerificationRequired: ${e.isVerificationRequired}")

            val failure = when {
                e.isCanceled -> AuthFailure.AuthCancelled
                e.isVerificationRequired -> AuthFailure.VerificationRequired(e.getDescription())
                else -> AuthFailure.OtherError(e.getDescription())
            }
            Timber.w("*********** webAuthLogin failure: $failure")
            Either.Error(failure)
        }

And MainActivity is regstered in AndroidManifest.xml:




            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="@string/fileProvider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_paths" />
    </provider>
</application>

Werdly, sometime MainActivity is closed but the Universal login screen stays when I open Universal login screen and the login screen does nothing.

I cannot figure out why this is happening because I just open the login screen.

I wanted to capture logs but the issue is not consistent and might need some time for that.

Thank you for your help in advance.