当运行expo构建android时,我如何修复此错误?

4

你好,我需要帮助。我的问题是我正在尝试从我的Expo React应用程序构建Android apk。但是当我尝试这样做时,它会失败。尝试运行'expo build:android'时显示的输出如下。在Android上使用Expo客户端运行时可以正常工作。请帮我。此项目的代码在此GitHub存储库中。

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)

这个问题已经被 Expo 团队解决了 https://forums.expo.io/t/can-update-app-in-playstore-problems-with-signing-and-fingerprint/31520/4。 - Muhammad Idrees
这里有另一个选项,希望能解决你的问题:https://github.com/joltup/rn-fetch-blob#user-content-http-data-transfer - Muhammad Idrees
3个回答

7

4

安装JAVA SE 15解决了这个问题。我认为关键工具与Java有关。


0
我在我的azure devops CI/CD pipeline(在macOs上运行)中遇到了与expo的"turtle build:android"命令相同的问题。经过进一步搜索,我找到了以下解决方法。
实际问题是android构建环境的JDK版本应与您在使用"keytool"生成"keystore.jks"文件时使用的JDK版本匹配。 截止到今天(2021年11月18日),最新的JAVA SE版本是17。如果我使用这个最新版本的SDK来生成keystore文件,它无法与构建环境的JDK(不是最新版本)解密。我使用JAVA SE 15生成了keystore.jks文件。这对我起作用。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接