Skip to content

Build error in getBuildVersion function in gitutils.gradle file. #1157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
csk1827 opened this issue Feb 16, 2018 · 8 comments
Closed

Build error in getBuildVersion function in gitutils.gradle file. #1157

csk1827 opened this issue Feb 16, 2018 · 8 comments

Comments

@csk1827
Copy link
Contributor

csk1827 commented Feb 16, 2018

A try-catch block is missing int getBuildVersion function in the file gitutils.gradle : https://github.com/commons-app/apps-android-commons/blob/master/gitutils.gradle, due to which following error is occurring Gradle sync failed: CreateProcess error=2, The system cannot find the file specified

A try-catch block is used in the function getBranchName which is declared exactly below the getBuildVersion function, but I think it's not declared here by mistake.

@maskaravivek
Copy link
Member

This error never happens with me. What version of the studio are you using?

@csk1827
Copy link
Contributor Author

csk1827 commented Feb 18, 2018

I am using Studio 3.0.1

This error occurred only when I first pulled the project from Github and tried to build the gradle in my system. For the first time, gradle built successfully only after I have added try-catch block there.

Now it's not showing any error even if I remove try-catch block. However, its a good practice to introduce try-catch block there.

@maskaravivek
Copy link
Member

I am not sure if it actually a good practice to have a try catch here. A try catch will let any errors happen silently and then any real issues would not be surfaced.

Open for discussion.

@neslihanturan
Copy link
Collaborator

@maskaravivek what is your opinion for this discuttion?

@maskaravivek
Copy link
Member

As I said,

A try catch will let any errors happen silently and then any real issues would not be surfaced.

We should rather debug issues which come because of these util methods. :)

@neslihanturan
Copy link
Collaborator

Closing it then

@misaochan
Copy link
Member

I just set up the project on a new PC - can confirm that this issue happened to me as well, and @SaiKrishna1827 's fix solved it. I am on Android Studio 3.2.1.

We may want to consider fixing this (if not through the try catch block, then through other methods), as it may discourage new contributors.

@misaochan misaochan changed the title Missing try-catch block in getBuildVersion function in gitutils.gradle file. Build error in getBuildVersion function in gitutils.gradle file. Jan 3, 2019
maskaravivek pushed a commit that referenced this issue Jan 3, 2019
… in gitutils.gradle … (#1158)

* Added try-catch block in getBuildVersion function in gitutils.gradle file.

* Formatting fix

* Add comment
@sivaraam
Copy link
Member

I suppose this is fixed. So, closing it. Do reopen if I closed it incorrectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants