本文介绍了Windows和OS X之间build.gradle中的相对路径有所不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目有一个包含密钥库文件(file.keystore)的文件夹.这是结构:

My project have a folder with the keystore file (file.keystore). This is the structure:

+---.gradle
|   \---2.2
|       \---taskArtifacts
+---.idea
|   +---copyright
|   \---libraries
+---app
|   +---build
|   |   +---generated
|   +---libs
|   \---src
|       +---androidTest
|       \---main
+---build
|   \---intermediates
|       \---dex-cache
+---gradle
|   \---wrapper
\---keystore

要在build.gradle中使用它,请使用以下代码:

To use it in build.gradle I use this:

signingConfigs {
    project {
        keyAlias 'project'
        keyPassword 'blabla'
        storeFile file('keystore\\file.keystore')
        storePassword 'blabla'
    }

在Windows中,所有内容都是正确的,因为它在以下位置搜索:

In windows everything is correct because it searches in:

/project/keystore/file.keystore

/project/keystore/file.keystore

但是在OS X中它正在搜索:

But in OS X it is searching in:

/project/app/keystore/file.keystore

/project/app/keystore/file.keystore

我应该如何在build.gradle中编码?

How should I code in the build.gradle?

推荐答案

尝试

project {
    keyAlias 'project'
    keyPassword 'blabla'
    storeFile file('../keystore/file.keystore')
    storePassword 'blabla'
}

我认为为时已晚.但这也许可以帮助遇到相同问题的人.

I think it was too late. But maybe this will help someone has the same problem.

这篇关于Windows和OS X之间build.gradle中的相对路径有所不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 19:08