Search code examples
angularionic-frameworkionic4ionic-native

Ionic 4 - Property 'dataDirectory' does not exist on type 'File' error build android


Has anyone seen this error Property 'dataDirectory' does not exist on type 'File'?

I imported that way in the file app.module.ts: import { File } from '@ionic-native/File/ngx'

And, in the component, I'm calling the File plugin just like that:

this.platform.ready().then(() => {
  let path = this.file.dataDirectory
  this.file.checkDir(path, MEDIA_FOLDER_NAME).then(() => {
    this.loadFiles()
  }, err => {
    this.file.createDir(path, MEDIA_FOLDER_NAME, false)
  })
})

Does anyone know how to resolve this error?

Thank you! :)

Ionic v4.7.1
@ionic-native/file v5.27.0
cordova-plugin-file v6.0.2

Solution

  • I went back to version 5.0.0 and solved the problem