0

I have an ionic project requiring me to write files from the ionic into mobile devices. This can be achieved using Cordova's cordova-plugin-file and @ionic-native/file.

When I add the plugin to my project it is throwing below error.

Channel not fired: onFileSystemPathsReady
Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.

The error can be seen in the console as well. Errors in console

Ionic info:

Ionic CLI                     : 7.2.0
Ionic Framework               : @ionic/angular 8.4.1
@angular-devkit/build-angular : 16.2.15
@angular-devkit/schematics    : 16.2.15
@angular/cli                  : 16.2.15
@ionic/angular-toolkit        : 11.0.1

Cordova:
Cordova CLI         : 12.0.0 ([email protected])
Cordova Platforms   : android 9.1.0, ios 6.2.0
cordova-plugin-file : version 5.0.0

app.module.ts file:

import { File } from "@ionic-native/file/ngx";

@NgModule({
    declarations: [AppComponent, ModalPage, CustomIonicModalComponent],
    imports: [
        MatDialogModule,
        BrowserModule,
        IonicModule.forRoot(),
        AppRoutingModule,
        FormRendererModule,
        FormsModule,
        BrowserAnimationsModule
    ],
    providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, MobileService, Keyboard, File],
    bootstrap: [AppComponent]
})
export class AppModule { }

app.component.ts file:

import { File } from '@ionic-native/file/ngx';

@Component({
    selector: 'app-root',
    templateUrl: 'app.component.html',
    styleUrls: ['app.component.scss'],
})

export class AppComponent {
    constructor(private file: File) {}
}

Things I have tried to address this issue:

  • Re-installing all plugins and other dependencies
  • Clearing all the cache and rebuilding
  • Removing the files plugin to check if that is causing the issue (after removing the plugin it is working as expected)
  • Upgrading and downgrading the file plugin
  • @ionic-native has been deprecated so I tried the @awesome-cordova-plugins/file but still getting the same error
  • Tried to install the latest version of the plugin as well as its dependencies. Also updated Cordova platforms to the latest versions.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.