问题描述
我将我的签名密钥到键
文件夹中的项目的根目录:
I added my signing keys into keys
folder in root of the project:
.\
keys\
sign.properties
src\
main\
build.gradle
我添加下一行到我的构建脚本:
I added next lines to my build script:
signingConfigs {
release {
Properties p = new Properties()
p.load(new FileInputStream('keys/sign.properties'))
storeFile file(p.file)
storePassword p.password
keyAlias p.alias
keyPassword p.keyPassword
}
}
命令行构建的gradle是能够组装构建。然而Android的工作室给了我错误文件 sign.properties
是找不到的。
如何AS指向它?
推荐答案
它看起来像的工作目录是在命令行中与从Android的工作室编译在编译时有问题。我看到的差异存在,我需要进一步调查,并可能提交错误的。在任何情况下,最好是明确有关的路径钉降至prevent混乱。
It looks like a problem with what the working directory is when compiling on the command line vs. compiling from Android Studio. I see a discrepancy there that I need to investigate further and possibly file a bug for. In any event, it's better to be explicit about nailing down the path to prevent confusion.
试试这个:
p.load(new FileInputStream(rootProject.file('keys/sign.properties')))
这将明确该文件是相对于项目(不是模块)的根,这也是其中 settings.gradle
文件生命。
This will nail down the file to be relative to the project (not the module) root, which is also where the settings.gradle
file lives.
修改
我提交的bug 这一点。我给你上面的解决办法应该做的很好,而且可能在任何情况下的最佳做法。
I filed bug https://code.google.com/p/android/issues/detail?id=64018 for this. The workaround I showed you above should do nicely, and is maybe a best practice in any event.
这篇关于Android Studio中无法找到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!