Android:启动进程'命令'gpg''时出现问题,错误=2,没有这样的文件或目录
以问答方式分享
问题陈述
我克隆了一个新项目,它具有 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'
其他信息
- gpg 已通过 < 安装code>brew install gnupg 并且只更新了一个。
- 终端中的命令
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
- gpg is already installed via
brew install gnupg
and it is updated one only. - The command
which gpg
in the terminal shows/opt/homebrew/bin/gpg
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题出在脚本
apply from:'../credentials/crypto.gradle'
。我们可以在 Android Studio 中按两次shift
并输入crypto.gradle
来转到该文件。在那里,我们可以找到单词gpg
。结果应如下所示:在这里,我们需要将
"gpg"
替换为从终端中的which gpg
命令获取的绝对 gpg 路径。对我来说,它给了我:/opt/homebrew/bin/gpg
。因此,我们需要编辑现有的“gpg”
脚本,如下所示:现在,我们可以单击
再试一次
来构建我们的Android项目,这一次,它不应该抛出启动进程'命令'gpg''时出现问题,...错误=2,没有这样的文件或目录
。The problem is in the script
apply from: '../credentials/crypto.gradle'
. We can pressshift
two times in Android Studio and typecrypto.gradle
to go to that file. There, we can find the wordgpg
. The result should look like below:Here, we need to replace the
"gpg"
with our absolute gpg path that we get fromwhich 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:Now, we can click on
Try again
to build our Android project and this time, it should not throw theA problem occurred starting process 'command 'gpg'', ... error=2, No such file or directory
.