JSON error with File.createDir

Hi, i want create a directory and file in my ionic 2 app.
I add cordova-plugin-file for that, and i test on android device emulator with AVD manager.

My code :

let targetPath = cordova.file.documentsDirectory;
console.log(targetPath); // print: file:///data/data .... /files/, it's okay

// CheckDir works!
File.checkDir(targetPath, 'files').then((data) => ....,
                        (data) => ...);

// Not works : reject with FileError{code = 'JSON Error'}
File.createDir(targetPath, 'toto', true).then((data) => ...),
                        (data) => );

i follow this doc http://ionicframework.com/docs/v2/native/file
What is the problem?


Same problem here, with ionic and cordova.

I am able to use the externalDataDirectory to createDir.

const fs: string = cordova.file.externalDataDirectory;
File.createDir(fs, 'newfolder', false)
  .then(_ => console.log('yay'))
  .catch(err => console.log('boooh')

However checkDir is not working for me.
Try yours without the checkDir in the externalDataDirectory.