Error executing 'ionic state save' after adding NativeAudio plugin [solved]

After adding the Native Audio plugin, I get an error when try to save the Ionic state:

$ ionic plugin add cordova-plugin-nativeaudio --save
$ ionic state save

There was an error saving your current Ionic setup
TypeError: Cannot read property ‘plugin’ of undefined
at Object.saveExistingPlugins (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/state.js:216:32)
at Object.saveState (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/state.js:72:11)
at (/usr/local/lib/node_modules/ionic/lib/ionic/state.js:55:11)
at Promise.apply (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:1078:26)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:741:41)
at /usr/local/lib/node_modules/ionic/node_modules/q/q.js:1304:14
at flush (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

Error parsing xml file: Error: Invalid character in entity name
Line: 8
Column: 54
Char: (CLI v2.2.1)

Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.0
ios-sim version: 5.0.12
OS: macOS Sierra
Node Version: v6.3.0
Xcode version: Xcode 8.2.1 Build version 8C1002

After removing the plugin, I am able to save:

$ ionic plugin remove cordova-plugin-nativeaudio
$ ionic state save

It appeared a problem with the xml in the plugin itself, worked with the following fork:

$ ionic plugin add --save
$ ionic state save
1 Like