Skip to content

[ionic 4.0.0] Failed to load resource: net::ERR_UNKNOWN_URL_SCHEME #237

@thenaim

Description

@thenaim

error link: cdvfile://localhost/persistent/imgcache/58f0fa6c8f79117ebbc575b1214450e63a7563d1.jpeg
screenshot

Ps: I took all the steps CORDOVA.md, but still does not work and do not understand what the problem is.
Pss: running app on android device

app.component.ts

this.platform.ready().then(() => {
    ...
    ImgCache.options.chromeQuota = 50 * 1024 * 1024;
    ImgCache.init(() => {
      console.log('OK');
    }, () => {
      console.log('ERROR');
    });
    ...
});

image-cache.directive.ts

import { Directive, ElementRef, OnInit } from '@angular/core';

declare var ImgCache: any;

@Directive({
  selector: '[appImageCache]'
})
export class ImageCacheDirective implements OnInit {
  constructor(
    private el: ElementRef
  ) { }

  ngOnInit() {
    ImgCache.isCached(this.el.nativeElement.src, (path: string, success: boolean) => {
      if (success) {
        ImgCache.useCachedFile(this.el.nativeElement);
      } else {
        ImgCache.cacheFile(this.el.nativeElement.src, () => {
          ImgCache.useCachedFile(this.el.nativeElement);
        });
      }
    });
  }
}

$ ionic info

Ionic:

   ionic (Ionic CLI)             : 4.9.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0
   @angular-devkit/build-angular : 0.12.4
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.2.4
   @ionic/angular-toolkit        : 1.2.3

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4, browser 5.0.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 30 other plugins)

System:

   Android SDK Tools : 26.1.1 (/home/ubuntu/Android/Sdk)
   NodeJS            : v10.14.2 (/usr/local/bin/node)
   npm               : 6.7.0
   OS                : Linux 4.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions