2
votes

I've been working on ionic project. The project uses various plugins including file transfer plugin.

Problem

When I install and run the app, it fails to download resources like image and audio from the api. When I debugged following error was shown:

{
    "code": 3,
    "source": "https://api.example.com/uploads/audio/011576657039579041.mp3",
    "target": "file:///data/user/0/com.myapp.snork/files/audio/011576657039579041.mp3",
    "http_status": null,
    "body": null,
    "exception": "java.security.cert.CertPathValidatorException: Trust anchor for certification path not found."
}

I tested it on Android 6, 7 and 8, with no luck. it works in iOS. Can anybody tell me what might be gone wrong??

What I have tried?

  • Removing and adding android platform again
  • Removing and adding file transfer plugin again.

My working Environment

  • @ionic/cli-utils : 1.19.2
  • ionic (Ionic CLI) : 3.20.0
  • @ionic/app-scripts : 1.3.8
  • Cordova Platforms : android 7.0.0 ios 4.3.1
  • Ionic Framework : ionic-angular 3.7.1
  • Android SDK Tools : 26.1.1

UPDATE

The source URL - https://api.example.com/uploads/audio/011576657039579041.mp3 can be accessible directly via browser, so there is nothing wrong in source URL.

Is it due to https ??

1
Try adding this <access origin="cdvfile://*" /> to your config.xml file.Kirubel
@Kirubel, I already have <access origin="*" /> isn't this enough?WatsMyName
Why not give it a try and lemme know.Kirubel
@Kirubel, unfortunately it didn't workWatsMyName
It's probably a certificate problem in your serverjcesarmobile

1 Answers

1
votes

For those who in case stumble upon same issue,

The issue was The SSL in my server was not properly configured.

I checked via https://www.sslshopper.com and the Intermediate CA was not properly configured.

After fixing this issue in the server, the app worked flawlessly on android device as well.