I have a managed expo app (sdk 48) which works fine when I'm developing locally on my emulator but as soon as I make a release build for android, the logins (google, facebook, microsoft) aren't working anymore. On IOS everything works as expected, locally and in release.

I was not getting any visible errors in the app so I prebuilt the app by running the command npx expo prebuild. This gave me the android folder which I opened in android studio. I was then able to make a release apk (with debugging enabled). I installed this apk on my physical device which was connected to android studio.

When checking the logcat I saw the following errors for my package id :

javax.crypto.AEADBadTagException
    at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:517)
    at javax.crypto.Cipher.doFinal(Cipher.java:2055)
    at expo.modules.securestore.SecureStoreModule$AESEncrypter.lambda$decryptItem$1(SecureStoreModule.java:466)
    at expo.modules.securestore.SecureStoreModule$AESEncrypter$$ExternalSyntheticLambda0.run(Unknown Source:2)
    at expo.modules.securestore.AuthenticationHelper.handleEncryptionCallback(AuthenticationHelper.kt:86)
    at expo.modules.securestore.AuthenticationHelper$defaultCallback$1.checkAuthentication(AuthenticationHelper.kt:73)
    at expo.modules.securestore.SecureStoreModule$AESEncrypter.decryptItem(SecureStoreModule.java:464)
    at expo.modules.securestore.SecureStoreModule.readJSONEncodedItem(SecureStoreModule.java:205)
    at expo.modules.securestore.SecureStoreModule.getItemImpl(SecureStoreModule.java:177)
    at expo.modules.securestore.SecureStoreModule.getValueWithKeyAsync(SecureStoreModule.java:165)
    at java.lang.reflect.Method.invoke(Native Method)
    at expo.modules.core.ExportedModule.invokeExportedMethod(ExportedModule.java:98)
    at expo.modules.adapters.react.NativeModulesProxy.callMethod(NativeModulesProxy.java:178)
    at expo.modules.kotlin.defaultmodules.NativeModulesProxyModule$definition$lambda$1$$inlined$AsyncFunction$1.invoke(ObjectDefinitionBuilder.kt:387)
    at expo.modules.kotlin.defaultmodules.NativeModulesProxyModule$definition$lambda$1$$inlined$AsyncFunction$1.invoke(ObjectDefinitionBuilder.kt:248)
    at expo.modules.kotlin.functions.AsyncFunctionWithPromiseComponent.callUserImplementation$expo_modules_core_release(AsyncFunctionWithPromiseComponent.kt:19)
    at expo.modules.kotlin.functions.AsyncFunction$attachToJSObject$2$1.invokeSuspend(AsyncFunction.kt:69)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:241)
    at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: android.security.KeyStoreException: Signature/MAC verification failed
    at android.security.KeyStore.getKeyStoreException(KeyStore.java:1303)
    at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:224)
    at android.security.keystore.AndroidKeyStoreAuthenticatedAESCipherSpi$BufferAllOutputUntilDoFinalStreamer.doFinal(AndroidKeyStoreAuthenticatedAESCipherSpi.java:373)
    at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:506)
    at javax.crypto.Cipher.doFinal(Cipher.java:2055) 
    at expo.modules.securestore.SecureStoreModule$AESEncrypter.lambda$decryptItem$1(SecureStoreModule.java:466) 
    at expo.modules.securestore.SecureStoreModule$AESEncrypter$$ExternalSyntheticLambda0.run(Unknown Source:2) 
    at expo.modules.securestore.AuthenticationHelper.handleEncryptionCallback(AuthenticationHelper.kt:86) 
    at expo.modules.securestore.AuthenticationHelper$defaultCallback$1.checkAuthentication(AuthenticationHelper.kt:73) 
    at expo.modules.securestore.SecureStoreModule$AESEncrypter.decryptItem(SecureStoreModule.java:464) 
    at expo.modules.securestore.SecureStoreModule.readJSONEncodedItem(SecureStoreModule.java:205) 
    at expo.modules.securestore.SecureStoreModule.getItemImpl(SecureStoreModule.java:177) 
    at expo.modules.securestore.SecureStoreModule.getValueWithKeyAsync(SecureStoreModule.java:165) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at expo.modules.core.ExportedModule.invokeExportedMethod(ExportedModule.java:98) 
    at expo.modules.adapters.react.NativeModulesProxy.callMethod(NativeModulesProxy.java:178) 
    at expo.modules.kotlin.defaultmodules.NativeModulesProxyModule$definition$lambda$1$$inlined$AsyncFunction$1.invoke(ObjectDefinitionBuilder.kt:387) 
    at expo.modules.kotlin.defaultmodules.NativeModulesProxyModule$definition$lambda$1$$inlined$AsyncFunction$1.invoke(ObjectDefinitionBuilder.kt:248) 
    at expo.modules.kotlin.functions.AsyncFunctionWithPromiseComponent.callUserImplementation$expo_modules_core_release(AsyncFunctionWithPromiseComponent.kt:19) 
    at expo.modules.kotlin.functions.AsyncFunction$attachToJSObject$2$1.invokeSuspend(AsyncFunction.kt:69) 
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 
    at android.os.Handler.handleCallback(Handler.java:883) 
    at android.os.Handler.dispatchMessage(Handler.java:100) 
    at android.os.Looper.loop(Looper.java:241) 
    at android.os.HandlerThread.run(HandlerThread.java:67) 

So I think it has something to do with my keystore file which is used to sign the release app? I have no clue why it would suddenly cause these errors as I have built the app previously without any problems.

I hope somebody can help me in the right direction :)

0

There are 0 answers