dpa99c / cordova-custom-config

Cordova/Phonegap plugin to update platform configuration files based on preferences and config-file data defined in config.xml
317 stars 85 forks source link

Error: Cannot read property 'getConfigXml' of undefined #118

Closed MaxBreida closed 7 years ago

MaxBreida commented 7 years ago

Hi,

since around 20 days i can't build my android app, probably since after the version bump to 4.0.0 of this plugin. At first there were 2 dependencies of cordova-custom-config missing which weren't missing before, tostr and elementtree. After adding these dependencies I am facing the error stated below:

Fetching plugin "cordova-custom-config" via npm
Installing "cordova-custom-config" for android
Installing "cordova-custom-config" for ios
cordova-custom-config: Skipping auto-restore of config file backup(s)
Error: Cannot read property 'getConfigXml' of undefined
[15:23:20] 'cordova-add-plugins' errored after 18 s
[15:23:20] Error: Command `cordova prepare` failed with exit code 1
    at ChildProcess.exithandler (child_process.js:213:12)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:818:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

I found another post at another cordova forum with the same problem, uninstalling the plugin fixed it for him.

cozzbie commented 7 years ago

Getting the same error. Not sure what I did wrong because project has been compiling fine prior.

dpa99c commented 7 years ago

I'm not able to reproduce this issue.

What version of cordova are you using? cordova-custom-config@4 relies on using cordova-fetch to install the plugin dependencies: see the Installation section for details. If you're unable to use cordova@7 for some reason, you are best pinning the version to cordova-custom-config@3.

If you are using cordova@7+ (or cordova@6.2+ with the --fetch option) and still encounter this error, then please run the operation that's failing with the --verbose option, and post the resulting console output here.

cozzbie commented 7 years ago

And uninstall and reinstall fixed it. I think what happened was that I installed a plugin that relies on the plugin and it seems like it corrupted it somehow.

dpa99c commented 7 years ago

@MaxBreida does uninstall/reinstall also fix it for you?

touficbatache commented 7 years ago

This issue is occuring with me too. I can't run --fetch as I am using an online service to compile my app: http://cocoon.io @dpa99c

COMPILER ERROR: 

Cannot read property 'getConfigXml' of undefined

CORDOVA LOG: 

[2017-09-10 13:03:00.278] [DEBUG] AndroidBuilder - [prepare] cordova restore platforms
[2017-09-10 13:03:00.290] [DEBUG] AndroidBuilder - [prepare] adding engine android@6.2.3
Subproject Path: CordovaLib
[2017-09-10 13:03:05.254] [DEBUG] AndroidBuilder - Cannot read property 'getConfigXml' of undefined
dpa99c commented 7 years ago

@touficbatache As documented:

This plugin is intended for the automated application of custom configuration to native platform projects in a local build environment.

touficbatache commented 7 years ago

Hmm, can't this be done in any way with cocoon.io?

dpa99c commented 7 years ago

@touficbatache You can try using cordova-custom-config@3 which doesn't rely on cordova-fetch, but obviously doesn't contain the latest features/bugfixes

touficbatache commented 7 years ago

Oh okay, thank you!