Could not remove ionic appPreferences plugin . why?


I could not remove ionic plugin cordova-plugin-app-preferences
through command :

ionic cordova plugin rm cordova-plugin-app-preferences

it shows error as

unhandled exception { Error: ENOENT: no such file or directory, unlink 'platforms/android/res/xml/apppreferences.xml'
  errno: -2,
  code: 'ENOENT',
  syscall: 'unlink',
  path: 'platforms/android/res/xml/apppreferences.xml' }
(node:6091) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, unlink 'platforms/android/res/xml/apppreferences.xml'
(node:6091) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

please help



There’s not enough information provided here to say for sure… But I am going to guess that you’re either using Cordova 7 or 8… It seems that some other plugins aren’t quite compatible and result in similar errors. I’ve not been able to get app preferences plugin working just yet (only been trying the last couple of hours), but I was able to get it uninstalled after encountering this error. What I did was go into the android.js for the plugin and commented out the ‘unlink’ likes for the failing files (once you get past this one, the other files will fail too because they also are not present). After that, I was able to run ‘plugin remove’ as expected - then I just went through and cleaned up plugin’s files manually.