我正在做一个项目并提交给我的一位同事审阅。在他们之前的审查中,他说我的 keystore
文件需要保存在相对路径中。我通过 GitHub
提交。目前,我的 keystore
文件保存在我的项目的根目录中。此外,在我的 build.gradle
中,我有以下内容:
signingConfigs {
config {
keyAlias 'Udacity'
keyPassword 'xxxxxxxx'
storeFile file('/Users/user/Applications/LiveVotingUdacity/livevotingkeystore')
storePassword 'xxxxxx'
}
}
如何保存到相对路径?我很困惑。
最佳答案
A relative path is a way to specify the location of a directory relative to another directory.
根据您的代码,您的keystore
文件位于此处。
/Users/user/Applications/LiveVotingUdacity/livevotingkeystore
build.gradle
文件,用于指定 signingConfigs
,位于 app
文件夹中:
/Users/user/Applications/LiveVotingUdacity/app
您需要以某种方式指定 keystore
文件位于文件夹树中的上一个文件夹中。有 ..
符号,字面意思是“父目录”。
因此要指定到您的keystore
的相对路径,您应该使用下一个路径
storeFile file('../livevotingkeystore')
关于java - 设置 keystore 文件的相对路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53025348/