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
To use it in build.gradle I use this:
signingConfigs {
project {
keyAlias 'project'
keyPassword 'blabla'
storeFile file('keystore\\file.keystore')
storePassword 'blabla'
}
In windows everything is correct because it searches in:
/project/keystore/file.keystore
But in OS X it is searching in:
/project/app/keystore/file.keystore
How should I code in the build.gradle?
To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build. gradle file. This declares a dependency on an Android library module named "mylibrary" (this name must match the library name defined with an include: in your settings.
The global properties file should be located in your home directory: On Windows: C:\Users\<you>\. gradle\gradle.
Gradle's local repository folder is: $USER_HOME/. gradle/caches/modules-2/files-2.1.
Use groovy String Interpolation $rootDir
property.
project {
...
storeFile file("$rootDir\keystore\file.keystore")
...
}
note that it uses "double quotation"
Linh Nguyen Vu is Correct! Below the Test! the keyword is Resolved:
Try
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With