简体   繁体   中英

How do I fix this error while running expo build android?

Hello, I need some help. So what's the case is I am trying to build an android apk from my expo react app. But when I try to do so, it fails. This is the output that is being shown when trying to run 'expo build:android'. It works fine when run on expo client on android. Please help me. The code for this project is in this GitHub repo .

✔ Choose the build type you would like: › apk
Checking if there is a build in progress...

Accessing credentials for setucoder in project storyhub5
✔ Would you like to upload a Keystore or have us generate one for you?
If you don't know what this means, let us generate it! :) › Generate new keystore
Failed to generate Android Keystore, it will be generated on Expo servers during the build
keytool exited with non-zero code: 1
Error: keytool exited with non-zero code: 1
    at ChildProcess.completionListener (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
    at Object.onceWrapper (events.js:422:26)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Socket.<anonymous> (internal/child_process.js:439:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:673:12)
    ...
    at spawnAsync (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
    at createKeystore (/@expo/xdl@59.0.14/src/credentials/AndroidCredentials.ts:155:18)
    at Object.generateUploadKeystore (/@expo/xdl@59.0.14/src/credentials/AndroidCredentials.ts:198:9)
    at UpdateKeystore.provideOrGenerate (/usr/local/lib/node_modules/expo-cli/src/credentials/views/AndroidKeystore.ts:68:53)
    at UpdateKeystore.open (/usr/local/lib/node_modules/expo-cli/src/credentials/views/AndroidKeystore.ts:39:22)
    at CredentialsManager.run (/usr/local/lib/node_modules/expo-cli/src/credentials/route.ts:41:12)
    at runCredentialsManager (/usr/local/lib/node_modules/expo-cli/src/credentials/route.ts:12:10)
    at AndroidBuilder.collectAndValidateCredentials (/usr/local/lib/node_modules/expo-cli/src/commands/build/AndroidBuilder.ts:88:7)
    at AndroidBuilder.run (/usr/local/lib/node_modules/expo-cli/src/commands/build/AndroidBuilder.ts:33:5)
    at AndroidBuilder.command (/usr/local/lib/node_modules/expo-cli/src/commands/build/BaseBuilder.ts:40:7)

Solution - March 2021 (on macOs - Big Sur)

Error keytool exited with non-zero code: 1

在此处输入图像描述

Install the latest Java SE Development Kit

在此处输入图像描述

Installing JAVA SE 15 fixed this issue. I think the key tool has something to do with java

I have same issue with expo's turtle build:android command in my azure devops CI/CD pipeline(Running on macOs). After a searching a bit more on this issue, I figured out the following.

The actual issue is the android build environment's JDK version should match the version of the JDK you have used while generating the keystore.jks file using keytool . As of today(18-Nov-2021), the latest JAVA SE version was 17. If I use this latest version of SDK to generate keystore file, that couldn't be decrypted with build environment's JDK (which is not latest). I have generated the keystore.jks file with JAVA SE 15. It worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM