React Native Android Standalone Build Failed, iOS successful

Hi -

Created an app with React-Native. Runs fine in Android , iOS simulators as well as locally tethered mobile devices.

React Native Version : listed in package.json

Expo Version 32.0.0

Running expo-cli build:ios returned no errors.

However, having problems interpreting the following error when running

expo build:android

Creating an Android build resulted in an error. For the most part, the build process was running okay until the part indicated by the message below.

> Task :app:transformDexArchiveWithDexMergerForProdKernelRelease
> Task :app:mergeProdKernelReleaseJniLibFolders
> Task :app:transformNativeLibsWithMergeJniLibsForProdKernelRelease
> Task :app:validateSigningProdKernelRelease
> Task :app:packageProdKernelRelease FAILED
30 actionable tasks: 30 executed
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:packageProdKernelRelease'.
[stderr] > Failed to read key QGNkZWxjb2wvTGV2ZWxQbGF5 from store "/tmp/turtle/keystore-3b7672ec-864a-445a-b695-ed56b27a4424.jks": Cannot recover key
[stderr] * Try:
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] * Get more help at
[stderr] BUILD FAILED in 5m 10s
Error: Process exited with non-zero code: 1
    at ChildProcess.child.on (/app/node_modules/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:39:21)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

Any thoughts or comments on this would be really appreciated.




When expo is signing APK it’s uses private key that is stored in keystore under some name(alias) in your case its QGNkZWxjb2wvTGV2ZWxQbGF5. In this case, keystore doesn’t have this alias which implies that those credentials are invalid for some reason. Based on alias I’m assuming that those credentials were generated by expo. Did you update them at any point? Is this first time you used build command?

If you didn’t upload any previous versions to the store yet just run build command with -c option which will clear credentials and generate new ones. You can also run expo fetch:android:keystore and verify whether displayed credentials are valid for the keystore.

1 Like

Thank you @wkozyra. I will try this over the weekend and update this thread.

There has been previous submissions of the app to the store (well, just once).
So if there are previous credentials, how could I a) clear the old one to use the one generated with expo or b) use the existing one from a previous submission (I believe I have the older keys) and remove the one that expo uses? I understand it may involve clearing the existing one with -c.

If you are using old method of signing and lose original keystore there is no way to reset or recover it, so you need to be careful with clearing credentials.

If you have original keystore, all necessary credentials(keystore password, alias, key password) and you are sure that this is one used to sign the first uploaded apk just run expo build:android -c and pass those values.

you can verify whether keystore is correct with

keytool -export -rfc
  -keystore your-keystore.jks
  -alias key-alias
  -file genereated_public_certificate.pem

check the one you have and one on expo servers(download it with expo fetch:android:keystore)

1 Like

All of this worked out. I did have the original keystore, and was able to build an .apk again. I would like to deploy this now to the Android Play Store, via the expo-cli (I had done so manually before with the completed .apk and the .apk file) so for now I will follow the deployment instructions using expo-cli referenced in the docs to start. If I encounter additional issues during deployment I will post as a separate question. thanks again!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.