0

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

Error

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=H:\sdk (DEPRECATED)
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:

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

Cordova:

   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)

Utility:

   cordova-res : not installed
   native-run  : 0.2.8

System:

   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

kelvin
  • 1,480
  • 1
  • 14
  • 28
  • 1
    Did your code work before? Maybe you should try to downgrade your Android as suggested [here](https://stackoverflow.com/questions/45025219/cordova-android-build-error-cannot-read-property-length-of-undefined). – AUBSieGUL Aug 30 '19 at 11:36
  • Yes it was working+ i tried with new Project too.but Same error. and That answer is lit. bit old .It will create a mess. – kelvin Aug 30 '19 at 11:39
  • 1
    try to remove and add platform. – Najam Us Saqib Aug 30 '19 at 11:58
  • @Najam Thanks but already did it. still no luck – kelvin Aug 30 '19 at 12:00
  • 1
    Downgrade Platofrm version to 7.0.0 or 7.0.1 – Najam Us Saqib Aug 30 '19 at 12:03
  • @Najam you mean cordova platform add android@7.0.0 ? I did it . still no luck – kelvin Aug 30 '19 at 12:12
  • 1
    I have never encountered this error before but I found [this github issue](https://github.com/angular/angular-cli/issues/5053) where a similar error for an older version is discussed. Maybe you should try ng serve or copy the project to a new folder and run npm install. If this doesn't help you should ask at the ionic board. – AUBSieGUL Aug 30 '19 at 12:33

0 Answers0