The relative path in build.gradle is different between Windows and OS X

My project has a folder with a 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 

To use it in build.gradle, I use this:

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

Everything is correct in the windows, because it searches in:

/project/keystore/file.keystore

But on OS X, he searches in:

/project/app/keystore/file.keystore

How do I code in build.gradle?

+5
source share
2 answers

Try

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

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

+8
source

Use the groovy String Interpolation $rootDir .

 project { ... storeFile file("$rootDir\keystore\file.keystore") ... } 

note that it uses a double quote

+4
source

All Articles