Build Error : Cannot read property 'length' of undefined in New Project

I reopened my old Ionic project and when i tried to build it i got “Cannot read property ‘length’ of undefined” error.

Note: I updated my Android Studio Recently

I have tried uninstalling and installing node and ionic


Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
Cannot read property ‘length’ of undefined
[ERROR] An error occurred while running subprocess cordova.

    cordova.cmd build android exited with exit code 1.

ionic info :


   Ionic CLI          : 5.2.7
   Ionic Framework    : ionic-angular 3.9.5
   @ionic/app-scripts : 3.2.2


   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic
-webview 4.1.1, (and 4 other plugins)


   cordova-res : not installed
   native-run  : 0.2.8


   Android SDK Tools : 25.2.3 (H:\sdk)
   NodeJS            : v10.16.3 (J:\Program Files\nodejs\node.exe)
   npm               : 6.11.2
   OS                : Windows 8.1

I am getting this error while running ionic cordova build android . It isn’t building. Any help would be appreciated

Can you display the code where you used ‘length’ property?

Thanks for showing interest in the query . I am getting this error while building application. even if i create new Application and run ionic cordova run android

That’s something problem in the code where you are trying to use this length property. can I see the code where you are trying to use length property?

It is a fresh project

Try to fix the aforementioned environment variables? Obviously cordova needs sdk and stuff to run

I don’t get it man. I am new to IONIC .

THis is not good. Fix this?

doesn’t solve the problem!!