Android:启动进程'命令'gpg''时出现问题,错误=2,没有这样的文件或目录

发布于 2025-01-09 11:36:31 字数 1288 浏览 2 评论 0原文

以问答方式分享

问题陈述

我克隆了一个新项目,它具有 gpg 加密。我通过在终端中运行 brew install gnupg 安装了 gpg 。我通过在终端中运行 which gpg 命令确认安装,它给了我 /opt/homebrew/bin/gpg 路径。我尝试构建该项目,但出现如下错误:

错误

A problem occurred evaluating script.
Build file '/Users/srdpatel/androidProjects/projectName/oneOfTheDirectoiesOutOfThreeSiblings/app/build.gradle' line: 10
A problem occurred evaluating script.
> A problem occurred starting process 'command 'gpg''
> A problem occurred starting process 'command 'gpg''
> org.gradle.api.GradleScriptException: A problem occurred evaluating script.
> Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'gpg'
> Caused by: java.io.IOException: Cannot run program "gpg" (in directory "/Users/srdpatel/androidProjects/projectName/oneOfTheDirectoriesOutOfThreeSiblings"): error=2, No such file or directory

应用程序级别 Gradle Line 10

apply from: '../credentials/crypto.gradle'

其他信息

  1. gpg 已通过 < 安装code>brew install gnupg 并且只更新了一个。
  2. 终端中的命令 which gpg 显示 /opt/homebrew/bin/gpg

Sharing it in Q&A Style

Problem Statement

I cloned a new project and it had gpg encryption. I installed gpg via running brew install gnupg in the terminal. I confirmed the installation via running which gpg command in the terminal and it gave me /opt/homebrew/bin/gpg path. I tried to build the project but it was giving the error as below:

Error

A problem occurred evaluating script.
Build file '/Users/srdpatel/androidProjects/projectName/oneOfTheDirectoiesOutOfThreeSiblings/app/build.gradle' line: 10
A problem occurred evaluating script.
> A problem occurred starting process 'command 'gpg''
> A problem occurred starting process 'command 'gpg''
> org.gradle.api.GradleScriptException: A problem occurred evaluating script.
> Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'gpg'
> Caused by: java.io.IOException: Cannot run program "gpg" (in directory "/Users/srdpatel/androidProjects/projectName/oneOfTheDirectoriesOutOfThreeSiblings"): error=2, No such file or directory

App Level Gradle Line 10

apply from: '../credentials/crypto.gradle'

Other information

  1. gpg is already installed via brew install gnupg and it is updated one only.
  2. The command which gpg in the terminal shows /opt/homebrew/bin/gpg.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

骷髅 2025-01-16 11:36:31

问题出在脚本apply from:'../credentials/crypto.gradle'。我们可以在 Android Studio 中按两次 shift 并输入 crypto.gradle 来转到该文件。在那里,我们可以找到单词gpg。结果应如下所示:

def result = execute("gpg", ...

在这里,我们需要将 "gpg" 替换为从终端中的 which gpg 命令获取的绝对 gpg 路径。对我来说,它给了我:/opt/homebrew/bin/gpg。因此,我们需要编辑现有的“gpg”脚本,如下所示:

def result = execute("/opt/homebrew/bin/gpg", ...

现在,我们可以单击再试一次来构建我们的Android项目,这一次,它不应该抛出启动进程'命令'gpg''时出现问题,...错误=2,没有这样的文件或目录

The problem is in the script apply from: '../credentials/crypto.gradle'. We can press shift two times in Android Studio and type crypto.gradle to go to that file. There, we can find the word gpg. The result should look like below:

def result = execute("gpg", ...

Here, we need to replace the "gpg" with our absolute gpg path that we get from which gpg command in the terminal. For me, it gave me: /opt/homebrew/bin/gpg. So, we need to edit the existing "gpg" script as below:

def result = execute("/opt/homebrew/bin/gpg", ...

Now, we can click on Try again to build our Android project and this time, it should not throw the A problem occurred starting process 'command 'gpg'', ... error=2, No such file or directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文