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
.
CodePudding user response:
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
.