Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

An error occurred during gradle syncing #50

Closed
vipozdn opened this issue May 2, 2021 · 3 comments
Closed

An error occurred during gradle syncing #50

vipozdn opened this issue May 2, 2021 · 3 comments
Labels
build error Build issues

Comments

@vipozdn
Copy link
Contributor

vipozdn commented May 2, 2021

gradle_issue

Changing System.getenv(KEYSTORE_PATH)
to String.valueOf(System.getenv(KEYSTORE_PATH))
solves the problem and makes a successful gradle sync

The same for the other three calls of System.getenv

If you accept this, assign it to me, please

@fartem fartem added the build error Build issues label May 3, 2021
@fartem
Copy link
Member

fartem commented May 3, 2021

Gradle send errors about this variables not declared. You need to add next lines in local.properties file in the project's root folder:

RELEASE_KEYSTORE_PATH=''
RELEASE_KEYSTORE_PASSWORD=''
RELEASE_KEY_ALIAS=''
RELEASE_KEY_PASSWORD=''

Yes, variables can be empty because you cannot sign the app while run debug version.

@fartem fartem closed this as completed May 3, 2021
@vipozdn
Copy link
Contributor Author

vipozdn commented May 3, 2021

Gradle send errors about this variables not declared. You need to add next lines in local.properties file in the project's root folder:

RELEASE_KEYSTORE_PATH=''
RELEASE_KEYSTORE_PASSWORD=''
RELEASE_KEY_ALIAS=''
RELEASE_KEY_PASSWORD=''

Yes, variables can be empty because you cannot sign the app while run debug version.

Yes, before opening issue i tried to declare this values in local.properties. The error disappeared.
But look at repo's code:

if (keystoreProperties[KEYSTORE_PATH] == null) {
                keystoreProperties.put(
                        KEYSTORE_PATH,
                        System.getenv(KEYSTORE_PATH)
                )
   ...
}

In my understanding if keystoreProperties[KEYSTORE_PATH] == null (and it is actually null, coz KEYSTORE_PATH not declared in local.properties by default), then keystoreProperties.put() calls, which saves value System.getenv(KEYSTORE_PATH) with a key KEYSTORE_PATH at local.properties.
In theory, your code is built in such a way that you do not need to declare keys in local.properties.

I tried to figure out why this error occurred and found answer that you need to add String.valueOf() for result of System.getenv(KEYSTORE_PATH)

Now gradle error disappears and you don't even need to declare keys in local.properties. Your code already does it for you.

@fartem
Copy link
Member

fartem commented May 3, 2021

@vipozdn Thanks. Yes, this is works. I'm added value reading from ENV for CI. local.properties contains values only for current project, and if in ENV you are declared variable with same name but for another project, release build fails. CI (in the app case - GitHub Actions) has a separated environment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build error Build issues
Projects
None yet
Development

No branches or pull requests

2 participants