Android Build Errored in Step 5 (Running Gradle)

Hi my Android expo build is erroring out in Step 5 (Running Gradle). This error is coming when I build using APK.

Specifically, it stops at the app:singReleaseBundle task.

Task :app:signReleaseBundle FAILED

[stderr]

FAILURE: Build failed with an exception.

[stderr]

* What went wrong:

[stderr]

Execution failed for task ':app:signReleaseBundle'.

[stderr]

> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

[stderr]

   > Failed to read key XXXXXXX= from store "/tmp/turtle/keystore-XXXXXXX.jks": Invalid keystore format

[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 https://help.gradle.org

[stderr]

BUILD FAILED in 4m 40s
32 actionable tasks: 32 executed
Error: ./gradlew exited with non-zero code: 1
    at ChildProcess.completionListener (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
    at Object.onceWrapper (events.js:418:26)
    at ChildProcess.emit (events.js:311:20)
    at ChildProcess.EventEmitter.emit (domain.js:482:12)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
    ...
    at spawnAsync (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
    at spawnAsyncThrowError (/app/turtle/node_modules/@expo/xdl/build/detach/ExponentTools.js:190:45)
    at buildShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:912:11)
    at async Object.createAndroidShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:406:5)
    at async runShellAppBuilder (/app/turtle/build/builders/android.js:83:9)
    at async Object.buildAndroid [as android] (/app/turtle/build/builders/android.js:31:28)
    at async build (/app/turtle/build/jobManager.js:158:24)
    at async processJob (/app/turtle/build/jobManager.js:103:32)
    at async Object.doJob (/app/turtle/build/jobManager.js:35:5)
    at async main (/app/turtle/build/server.js:44:13)

Does anyone have any suggestions on how to resolve this error?

Your keystore might be malformed or in a wrong format.

How did you generate your keystore?
The most common problem I have seen was not using option -storetype JKS when generating it with keytool which in some cases generates keystore in pkcs format instead of jks. Your file is named .jks but it’s .p12 file

Use keytool -list -keystore <keystore.jks> to verify if I’m correct and if that is the case use keytool -importkeystore to convert from pkcs to jks.

Before you do anything backup keystore and passwords somewhere.

1 Like

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