apache / apache/cordova-android

getASPath.bat fails for project paths with parenthesis

Open
#824 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.8k
Forks
1.6k
Avg merge
16h 18m
Merged PRs (30d)
11

Description

# Bug Report
Suddenly I couldn't build my project because it was coming at me with this error:
```
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
```
After a bit of digging my guess was because I had recently renamed my project folder to have parenthesis. (eg. "myCordova(chromecast)")
Removing the parenthesis made it work again.

## Problem
I believe the problem lies in myCordova(chromecast)\platforms\android\cordova\lib\getASPath.bat` ([getASPath.bat on github](https://github.com/apache/cordova-android/blob/master/bin/templates/cordova/lib/getASPath.bat))

When I uncomment lines 93 and 94 from `myCordova(chromecast)\platforms\android\cordova\lib\check_reqs.js`
```
92 var result = child_process.spawnSync(path.join(__dirname, 'getASPath.bat'));
93 console.log('result.stdout =' + result.stdout.toString());
94 console.log('result.stderr =' + result.stderr.toString());
```
I get this output:
```
result.stdout =
result.stderr ='S:\Projects\myCordova' is not recognized as an internal or external command,
```

So it looks like getASPath.bat does not handle the parenthesis well (since it truncated the path in the output).
(See my next comment for more detailed debugging)

### Command or Code
`cordova run android`

### Environment, Platform, Device
Windows, Android

### Version information
https://github.com/apache/cordova-android.git#4cf3dcfaae6dc82ddb1ccf439d209cbcc2f474a0
(getASPath.bat is the same on this commit as it is on master.)

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Inspect platforms/android/cordova/lib/getASPath.bat, using platforms/android/cordova/lib/check_reqs.js and the reported Windows project path with parentheses to reproduce the failure. Run cordova run android and confirm that the Gradle detection succeeds for paths such as myCordova(chromecast).

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript, shell
Domain
build-system, mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.