Skip to content

Fix failing android build command by forcing use of gradle #2020

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

Merged
merged 1 commit into from
Aug 30, 2016

Conversation

rosen-vladimirov
Copy link
Contributor

When there's platforms/android directory, but in package.json there's no entry in nativescript for android platform, calling tns build android or any build related command will fail with error:
Cannot read property 'version' of undefined
The reason is that we are trying to check the version in package.json and check if it allows us to use gradle (previously Android builds required Ant).
Prevent the error and force using gradle in such case.

NOTE: The issue can be reproduced when working in new repository and you've added the platforms directory to .gitignore file. After adding android platform, you'll notice changes in your package.json. Instead of commiting them, I've called git reset --hard which removed them from package.json, but I still have the platforms directory.

When there's `platforms/android` directory, but in package.json there's no entry in `nativescript` for android platform, calling `tns build android` or any build related command will fail with error:
`Cannot read property 'version' of undefined`
The reason is that we are trying to check the version in package.json and check if it allows us to use gradle (previously Android builds required Ant).
Prevent the error and force using gradle in such case.
@rosen-vladimirov rosen-vladimirov self-assigned this Aug 30, 2016
@rosen-vladimirov rosen-vladimirov merged commit 88304f2 into master Aug 30, 2016
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/fix-android-error branch August 30, 2016 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant