I m using Cordova version 7.0.1 and Cordova android version is 6.2.3. I was facing the issue while performing android build. I m using only Cordova CLI and not using android studio at all.
The quick workaround for this issue before its official fixed in Cordova is as follows:
check_reqs.js
file under platforms\android\cordova\lib folderandroidStudioPath
variable null check in get_gradle_wrapper
function as below:Existing code:
else { //OK, let's try to check for Gradle! return forgivingWhichSync('gradle'); }
Modified code:
else { //OK, let's try to check for Gradle! var sdkDir = process.env['ANDROID_HOME']; return path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper', 'gradlew'); }
NOTE: This change needs to be done everytime when the android platform is removed and re-added
UPDATE: In my case, I already had gradle wrapper inside my android SDK and I dint find necessity to install gradle explicitly. Hence, I made this workaround to minimize my impact and effort