6

I am working on a project and submitted for review by one of my peers. In their previous review, he stated that my keystore file needed to be saved in a relative path. I am submitting via GitHub. Currently, my keystore file is saved in the root directory of my project. Also, in my build.gradle, I have the following:

signingConfigs {
    config {
        keyAlias 'Udacity'
        keyPassword 'xxxxxxxx'
        storeFile file('/Users/user/Applications/LiveVotingUdacity/livevotingkeystore')
        storePassword 'xxxxxx'
    }
}

How do I save to a relative path? I am very confused.

1 Answer 1

12

A relative path is a way to specify the location of a directory relative to another directory.


According to your code, your keystore file is located here.

/Users/user/Applications/LiveVotingUdacity/livevotingkeystore

And build.gradle file, which you use to specify signingConfigs, is placed inside you app folder:

/Users/user/Applications/LiveVotingUdacity/app

You need somehow specify that keystore file is located one folder above in folder tree. There is .. symbol which literally means 'parent directory'.

So to specify relative path to your keystore, you should use the next path

storeFile file('../livevotingkeystore')
Sign up to request clarification or add additional context in comments.

2 Comments

So I simply need to change my build.gradle to reflect what you listed above? And it will essentially serve as a reference to the reviewer to know where to locate the file, is that strictly the purpose?
@tccpg288 yes. If you change your code in that way, it will works without any changes, for anyone who will pull it from Github. But now it will works only on your machine :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.