When asking for help in this category, please make sure to provide the following details:
- SDK Version: 9.0.2
- Platform: android
Hello,
I’m currently integrating the Web3Auth library in our Android application and have encountered a recurring crash affecting about 3% of our users. The crash error is as follows:
Fatal Exception: n7.L: lateinit property loginCompletableFuture has not been initialized
at com.web3auth.core.Web3Auth$setResultUrl$3$1.invoke(Web3Auth.kt:254)
at com.web3auth.core.Web3Auth$setResultUrl$3$1.invoke(Web3Auth.kt:232)
at com.web3auth.core.Web3Auth.runOnUIThread$lambda-14(Web3Auth.kt:579)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8919)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
initialize & login code snippet
fun connectWeb3Auth(web3auth: Web3Auth, isSign: Boolean = true) {
state.postValue(WalletState.InProgress)
val sessionResponse: CompletableFuture<Void> = web3auth.initialize()
sessionResponse.whenComplete { _, error ->
if (error == null) {
val credentials = Credentials.create(web3auth.getPrivkey())
} else {
Timber.e("sessionResponse connectWeb3Auth error: ${error.message ?: "Something went wrong"}")
}
}
auth.currentUser?.let { user ->
user.getIdToken(true).addOnSuccessListener { result ->
result.token?.let { token ->
val loginParams = web3AuthManager.prepareLoginParams(user.uid, token)
val loginCompletableFuture = web3auth.login(loginParams)
loginCompletableFuture.whenComplete { response, error ->
if (error == null) {
if (!response.userInfo?.dappShare.isNullOrEmpty())
KeyStoreManager.storeEncryptedData(context, user.uid, response.userInfo?.dappShare!!)
val credentials = Credentials.create(web3auth.getPrivkey())
web3AuthManager.enableMFA(web3auth,
success = {
state.postValue(WalletState.ConnectedWallet(credentials.address))
if (isSign) connectSignWeb3Auth(credentials)
}, error = {
state.postValue(WalletState.Web3AuthFailed(it))
}
)
} else {
state.postValue(WalletState.Web3AuthFailed(error.message?:"error"))
}
}
} ?: run {
state.postValue(WalletState.Web3AuthFailed("GetTokenResult null"))
}
}
}
}
Android Version Distribution:
Our crash analytics show that most crashes occur on devices running Android 14 (SDK 34), with significant contributions from Android 12 (SDK 31) and Android 13 (SDK 33). Other versions account for a much smaller portion of the crashes.
Could you please advise if:
- There is a known issue or workaround regarding the uninitialized
loginCompletableFuture
? - Further initialization steps or configuration adjustments are required on our end?
- A patch or update is planned to address this error?
Any assistance or guidance to resolve this issue would be greatly appreciated. Please let me know if additional information or logs are required.
Thank you for your support!
Best regards,
Ron