Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
I've searched for solutions to this problem, and found several reports of it, but no solutions. Based on my many attempts to get something to work (I've tried phonegap, ionic, and just plain cordova), I started suspecting that there's a bug in the cordova android platform. All my build attempts have been halted at this error message:
Error: Cannot read property 'length' of undefined
Replicating this issue with phonegap:
I'm starting with phonegap because this is how I first encountered the error, and it seems to give me the most useful information with regard to where the error is happening.
$ npm install -g phonegap
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
C:\Users\bbale\AppData\Roaming\npm\phonegap -> C:\Users\bbale\AppData\Roaming\npm\node_modules\phonegap\bin\phonegap.js
+ phonegap@6.5.2
added 873 packages in 146.435s
$ phonegap create pgHello --id "com.pghello.app" --name "pgHello" --template hello-world
Creating a new cordova project.
$ cd pgHello
$ phonegap run android --verbose
[phonegap] executing 'cordova platform add --save android ' ...
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.pghello.app
Name: pgHello
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android@6.1.2
Discovered plugin "cordova-plugin-battery-status" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-battery-status@~1.1.1" via npm
Installing "cordova-plugin-battery-status" for android
Saved plugin info for "cordova-plugin-battery-status" to config.xml
Discovered plugin "cordova-plugin-camera" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-camera@~2.1.1" via npm
Installing "cordova-plugin-camera" for android
Saved plugin info for "cordova-plugin-camera" to config.xml
Discovered plugin "cordova-plugin-media-capture" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-media-capture@~1.2.0" via npm
Installing "cordova-plugin-media-capture" for android
Fetching plugin "cordova-plugin-file" via npm
Installing "cordova-plugin-file" for android
Fetching plugin "cordova-plugin-compat" via npm
Installing "cordova-plugin-compat" for android
The Android Persistent storage location now defaults to "Internal". Please check this plugin's README to see if your application needs any changes in its config.xml.
If this is a new application no changes are required.
If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:
"<preference name="AndroidPersistentFileLocation" value="Compatibility" />"
to config.xml in order for the application to find previously stored files.
Saved plugin info for "cordova-plugin-media-capture" to config.xml
Discovered plugin "cordova-plugin-console" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-console@~1.0.2" via npm
Installing "cordova-plugin-console" for android
Saved plugin info for "cordova-plugin-console" to config.xml
Discovered plugin "cordova-plugin-contacts" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-contacts@~2.0.1" via npm
Installing "cordova-plugin-contacts" for android
Saved plugin info for "cordova-plugin-contacts" to config.xml
Discovered plugin "cordova-plugin-device" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-device@~1.1.1" via npm
Installing "cordova-plugin-device" for android
Saved plugin info for "cordova-plugin-device" to config.xml
Discovered plugin "cordova-plugin-device-motion" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-device-motion@~1.2.0" via npm
Installing "cordova-plugin-device-motion" for android
Saved plugin info for "cordova-plugin-device-motion" to config.xml
Discovered plugin "cordova-plugin-device-orientation" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-device-orientation@~1.0.2" via npm
Installing "cordova-plugin-device-orientation" for android
Saved plugin info for "cordova-plugin-device-orientation" to config.xml
Discovered plugin "cordova-plugin-dialogs" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-dialogs@~1.2.0" via npm
Installing "cordova-plugin-dialogs" for android
Saved plugin info for "cordova-plugin-dialogs" to config.xml
Discovered plugin "cordova-plugin-file-transfer" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-file-transfer@~1.5.0" via npm
Installing "cordova-plugin-file-transfer" for android
Dependent plugin "cordova-plugin-file" already installed on android.
Saved plugin info for "cordova-plugin-file-transfer" to config.xml
Discovered plugin "cordova-plugin-geolocation" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-geolocation@~2.1.0" via npm
Installing "cordova-plugin-geolocation" for android
Saved plugin info for "cordova-plugin-geolocation" to config.xml
Discovered plugin "cordova-plugin-globalization" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-globalization@~1.0.3" via npm
Installing "cordova-plugin-globalization" for android
Saved plugin info for "cordova-plugin-globalization" to config.xml
Discovered plugin "cordova-plugin-inappbrowser" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-inappbrowser@~1.3.0" via npm
Installing "cordova-plugin-inappbrowser" for android
Saved plugin info for "cordova-plugin-inappbrowser" to config.xml
Discovered plugin "cordova-plugin-media" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-media@~2.2.0" via npm
Installing "cordova-plugin-media" for android
Dependent plugin "cordova-plugin-file" already installed on android.
Saved plugin info for "cordova-plugin-media" to config.xml
Discovered plugin "cordova-plugin-network-information" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-network-information@~1.2.0" via npm
Installing "cordova-plugin-network-information" for android
Saved plugin info for "cordova-plugin-network-information" to config.xml
Discovered plugin "cordova-plugin-splashscreen" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-splashscreen@~3.2.1" via npm
Installing "cordova-plugin-splashscreen" for android
Saved plugin info for "cordova-plugin-splashscreen" to config.xml
Discovered plugin "cordova-plugin-statusbar" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-statusbar@~2.1.2" via npm
Installing "cordova-plugin-statusbar" for android
Saved plugin info for "cordova-plugin-statusbar" to config.xml
Discovered plugin "cordova-plugin-vibration" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-vibration@~2.1.0" via npm
Installing "cordova-plugin-vibration" for android
Saved plugin info for "cordova-plugin-vibration" to config.xml
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-whitelist@~1.2.1" via npm
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do not need this plugin since the whitelist will be built in.
Saved plugin info for "cordova-plugin-whitelist" to config.xml
--save flag or autosave detected
Saving android@~6.1.2 into config.xml file ...
[phonegap] completed 'cordova platform add --save android --no-telemetry'
[phonegap] executing 'cordova build android --verbose ' ...
No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking config.xml for saved platforms that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at C:\nodejs\apps\pgHello\platforms\android\res\xml\config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms\android\platform_www] to platforms\android\assets\www
copy platforms\android\platform_www\cordova_plugins.js platforms\android\assets\www\cordova_plugins.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-battery-status\www\battery.js platforms\android\assets\www\plugins\cordova-plugin-battery-status\www\battery.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-camera\www\Camera.js platforms\android\assets\www\plugins\cordova-plugin-camera\www\Camera.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-camera\www\CameraConstants.js platforms\android\assets\www\plugins\cordova-plugin-camera\www\CameraConstants.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-camera\www\CameraPopoverHandle.js platforms\android\assets\www\plugins\cordova-plugin-camera\www\CameraPopoverHandle.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-camera\www\CameraPopoverOptions.js platforms\android\assets\www\plugins\cordova-plugin-camera\www\CameraPopoverOptions.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-contacts\www\Contact.js platforms\android\assets\www\plugins\cordova-plugin-contacts\www\Contact.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-contacts\www\ContactAddress.js platforms\android\assets\www\plugins\cordova-plugin-contacts\www\ContactAddress.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-contacts\www\ContactError.js platforms\android\assets\www\plugins\cordova-plugin-contacts\www\ContactError.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-contacts\www\ContactField.js platforms\android\assets\www\plugins\cordova-plugin-contacts\www\ContactField.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-contacts\www\ContactFieldType.js platforms\android\assets\www\plugins\cordova-plugin-contacts\www\ContactFieldType.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-contacts\www\ContactFindOptions.js platforms\android\assets\www\plugins\cordova-plugin-contacts\www\ContactFindOptions.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-contacts\www\ContactName.js platforms\android\assets\www\plugins\cordova-plugin-contacts\www\ContactName.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-contacts\www\ContactOrganization.js platforms\android\assets\www\plugins\cordova-plugin-contacts\www\ContactOrganization.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-contacts\www\contacts.js platforms\android\assets\www\plugins\cordova-plugin-contacts\www\contacts.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-device-motion\www\Acceleration.js platforms\android\assets\www\plugins\cordova-plugin-device-motion\www\Acceleration.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-device-motion\www\accelerometer.js platforms\android\assets\www\plugins\cordova-plugin-device-motion\www\accelerometer.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-device-orientation\www\CompassError.js platforms\android\assets\www\plugins\cordova-plugin-device-orientation\www\CompassError.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-device-orientation\www\CompassHeading.js platforms\android\assets\www\plugins\cordova-plugin-device-orientation\www\CompassHeading.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-device-orientation\www\compass.js platforms\android\assets\www\plugins\cordova-plugin-device-orientation\www\compass.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-device\www\device.js platforms\android\assets\www\plugins\cordova-plugin-device\www\device.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-dialogs\www\android\notification.js platforms\android\assets\www\plugins\cordova-plugin-dialogs\www\android\notification.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-dialogs\www\notification.js platforms\android\assets\www\plugins\cordova-plugin-dialogs\www\notification.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file-transfer\www\FileTransfer.js platforms\android\assets\www\plugins\cordova-plugin-file-transfer\www\FileTransfer.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file-transfer\www\FileTransferError.js platforms\android\assets\www\plugins\cordova-plugin-file-transfer\www\FileTransferError.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\DirectoryEntry.js platforms\android\assets\www\plugins\cordova-plugin-file\www\DirectoryEntry.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\DirectoryReader.js platforms\android\assets\www\plugins\cordova-plugin-file\www\DirectoryReader.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\Entry.js platforms\android\assets\www\plugins\cordova-plugin-file\www\Entry.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\File.js platforms\android\assets\www\plugins\cordova-plugin-file\www\File.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\FileEntry.js platforms\android\assets\www\plugins\cordova-plugin-file\www\FileEntry.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\FileError.js platforms\android\assets\www\plugins\cordova-plugin-file\www\FileError.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\FileReader.js platforms\android\assets\www\plugins\cordova-plugin-file\www\FileReader.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\FileSystem.js platforms\android\assets\www\plugins\cordova-plugin-file\www\FileSystem.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\FileUploadOptions.js platforms\android\assets\www\plugins\cordova-plugin-file\www\FileUploadOptions.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\FileUploadResult.js platforms\android\assets\www\plugins\cordova-plugin-file\www\FileUploadResult.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\FileWriter.js platforms\android\assets\www\plugins\cordova-plugin-file\www\FileWriter.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\Flags.js platforms\android\assets\www\plugins\cordova-plugin-file\www\Flags.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\LocalFileSystem.js platforms\android\assets\www\plugins\cordova-plugin-file\www\LocalFileSystem.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\Metadata.js platforms\android\assets\www\plugins\cordova-plugin-file\www\Metadata.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\ProgressEvent.js platforms\android\assets\www\plugins\cordova-plugin-file\www\ProgressEvent.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\android\FileSystem.js platforms\android\assets\www\plugins\cordova-plugin-file\www\android\FileSystem.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\browser\isChrome.js platforms\android\assets\www\plugins\cordova-plugin-file\www\browser\isChrome.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\fileSystemPaths.js platforms\android\assets\www\plugins\cordova-plugin-file\www\fileSystemPaths.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\fileSystems-roots.js platforms\android\assets\www\plugins\cordova-plugin-file\www\fileSystems-roots.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\fileSystems.js platforms\android\assets\www\plugins\cordova-plugin-file\www\fileSystems.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\requestFileSystem.js platforms\android\assets\www\plugins\cordova-plugin-file\www\requestFileSystem.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-file\www\resolveLocalFileSystemURI.js platforms\android\assets\www\plugins\cordova-plugin-file\www\resolveLocalFileSystemURI.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-geolocation\www\PositionError.js platforms\android\assets\www\plugins\cordova-plugin-geolocation\www\PositionError.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-geolocation\www\android\geolocation.js platforms\android\assets\www\plugins\cordova-plugin-geolocation\www\android\geolocation.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-globalization\www\GlobalizationError.js platforms\android\assets\www\plugins\cordova-plugin-globalization\www\GlobalizationError.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-globalization\www\globalization.js platforms\android\assets\www\plugins\cordova-plugin-globalization\www\globalization.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-inappbrowser\www\inappbrowser.js platforms\android\assets\www\plugins\cordova-plugin-inappbrowser\www\inappbrowser.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-media-capture\www\CaptureAudioOptions.js platforms\android\assets\www\plugins\cordova-plugin-media-capture\www\CaptureAudioOptions.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-media-capture\www\CaptureError.js platforms\android\assets\www\plugins\cordova-plugin-media-capture\www\CaptureError.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-media-capture\www\CaptureImageOptions.js platforms\android\assets\www\plugins\cordova-plugin-media-capture\www\CaptureImageOptions.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-media-capture\www\CaptureVideoOptions.js platforms\android\assets\www\plugins\cordova-plugin-media-capture\www\CaptureVideoOptions.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-media-capture\www\MediaFile.js platforms\android\assets\www\plugins\cordova-plugin-media-capture\www\MediaFile.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-media-capture\www\MediaFileData.js platforms\android\assets\www\plugins\cordova-plugin-media-capture\www\MediaFileData.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-media-capture\www\capture.js platforms\android\assets\www\plugins\cordova-plugin-media-capture\www\capture.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-media\www\Media.js platforms\android\assets\www\plugins\cordova-plugin-media\www\Media.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-media\www\MediaError.js platforms\android\assets\www\plugins\cordova-plugin-media\www\MediaError.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-network-information\www\Connection.js platforms\android\assets\www\plugins\cordova-plugin-network-information\www\Connection.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-network-information\www\network.js platforms\android\assets\www\plugins\cordova-plugin-network-information\www\network.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-splashscreen\www\splashscreen.js platforms\android\assets\www\plugins\cordova-plugin-splashscreen\www\splashscreen.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-statusbar\www\statusbar.js platforms\android\assets\www\plugins\cordova-plugin-statusbar\www\statusbar.js (updated file)
copy platforms\android\platform_www\plugins\cordova-plugin-vibration\www\vibration.js platforms\android\assets\www\plugins\cordova-plugin-vibration\www\vibration.js (updated file)
Wrote out android application name "pgHello" to C:\nodejs\apps\pgHello\platforms\android\res\values\strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000
Wrote out Android package name "com.pghello.app" to C:\nodejs\apps\pgHello\platforms\android\src\com\pghello\app\MainActivity.java
Updating icons at platforms\android\res
Updating splash screens at platforms\android\res
Prepared android project successfully
No scripts found for hook "after_prepare".
Checking config.xml for saved plugins that haven't been added to the project
No scripts found for hook "before_compile".
ANDROID_HOME=c:\android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
Error: Error
at Object.module.exports.check_gradle (C:\nodejs\apps\pgHello\platforms\android\cordova\lib\check_reqs.js:90:25)
at GradleBuilder.prepEnv (C:\nodejs\apps\pgHello\platforms\android\cordova\lib\builders\GradleBuilder.js:161:23)
at Api.module.exports.run (C:\nodejs\apps\pgHello\platforms\android\cordova\lib\build.js:152:20)
at C:\nodejs\apps\pgHello\platforms\android\cordova\Api.js:348:43
at _fulfilled (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:796:13)
at C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:604:44
at runSingle (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:125:13)
Note that the default cordova android platform version was android@~6.1.2. The error message here is "Error: Error".
Then I updated to cordova android platform 6.2.3.
$ phonegap cordova platform rm android
$ phonegap cordova platform add android@6.2.3
And here's what happened:
$ phonegap build android --verbose
[phonegap] executing 'cordova build android --verbose ' ...
No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking config.xml for saved platforms that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at C:\nodejs\apps\pgHello\platforms\android\res\xml\config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms\android\platform_www] to platforms\android\assets\www
Wrote out android application name "pgHello" to C:\nodejs\apps\pgHello\platforms\android\res\values\strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000
Wrote out Android package name "com.pghello.app" to C:\nodejs\apps\pgHello\platforms\android\src\com\pghello\app\MainActivity.java
Updating icons at platforms\android\res
Updating splash screens at platforms\android\res
This app does not have additional resource files defined
Prepared android project successfully
No scripts found for hook "after_prepare".
Checking config.xml for saved plugins that haven't been added to the project
No scripts found for hook "before_compile".
ANDROID_HOME=c:\android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
Error: TypeError: Cannot read property 'length' of undefined
at Object.module.exports.check_gradle (C:\nodejs\apps\pgHello\platforms\android\cordova\lib\check_reqs.js:143:19)
at GradleBuilder.prepEnv (C:\nodejs\apps\pgHello\platforms\android\cordova\lib\builders\GradleBuilder.js:176:23)
at Api.module.exports.run (C:\nodejs\apps\pgHello\platforms\android\cordova\lib\build.js:152:20)
at C:\nodejs\apps\pgHello\platforms\android\cordova\Api.js:348:43
at _fulfilled (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:624:44
at runSingle (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:125:13)
Note that the error now becomes "Error: TypeError: Cannot read property 'length' of undefined" instead of "Error: Error". The only difference is which version of the cordova android platform I use.
Replicating with Cordova:
I'm including this to demonstrate that the problem is not in phonegap, but seems to be in the cordova android platform.
$ cordova create pushTest com.copperfielld.kostizi.pushtest pushTest
Creating a new cordova project.
$ cd pushTest
$ cordova add android@6.2.3
Using cordova-fetch for cordova-android@6.2.3
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.copperfielld.kostizi.pushtest
Name: pushTest
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android@6.2.3
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do not need this plugin since the whitelist will be built in.
--save flag or autosave detected
Saving android@~6.2.3 into config.xml file ...
$ cordova run android --verbose
No scripts found for hook "before_run".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform android
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at C:\nodejs\apps\pushTest\platforms\android\res\xml\config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms\android\platform_www] to platforms\android\assets\www
Wrote out android application name "pushTest" to C:\nodejs\apps\pushTest\platforms\android\res\values\strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000
Wrote out Android package name "com.copperfielld.kostizi.pushtest" to C:\nodejs\apps\pushTest\platforms\android\src\com\copperfielld\kostizi\pushtest\MainActivity.java
This app does not have launcher icons defined
This app does not have splash screens defined
This app does not have additional resource files defined
Prepared android project successfully
No scripts found for hook "after_prepare".
ANDROID_HOME=c:\android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
Error: Cannot read property 'length' of undefined
Note that there are fewer details about the error, but it's the same message as before:
Error: Cannot read property 'length' of undefined
Attachments
Issue Links
- duplicates
-
CB-12976 During cordova-android build, get Error: Cannot read property 'length' of undefined
- Closed