question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

file-transfer cordova plugin is not working on Android

See original GitHub issue

Description of the problem: Downloading a file in the Ionic 4/Capacitor application with file-transfer cordova plugin is not working on Android. It works fine on iOS but immediately fails with 401 error on Android. I tried to debug it in Android Studio and it looks like this plugin methods are not even hit…

Affected platform

  • Android
  • iOS
  • electron
  • web

OS of the development machine

  • Windows
  • macOS
  • linux

Other information: ionic info output

Ionic:

   ionic (Ionic CLI)             : 4.5.0 (/Users/alexryltsov/.nvm/versions/node/v10.14.2/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0
   @angular-devkit/build-angular : 0.12.3
   @angular-devkit/schematics    : 7.2.3
   @angular/cli                  : 7.2.3
   @ionic/angular-toolkit        : 1.2.3

Capacitor:

   capacitor (Capacitor CLI) : 1.0.0-beta.17
   @capacitor/core           : 1.0.0-beta.17

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : none
   Cordova Plugins       : no whitelisted plugins (4 plugins total)

System:

   Android SDK Tools : 26.1.1 (/Users/alexryltsov/Library/Android/sdk/)
   NodeJS            : v10.14.2 (/Users/alexryltsov/.nvm/versions/node/v10.14.2/bin/node)
   npm               : 6.5.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.1 Build version 10B61

Capacitor version: see above

node version: see above

npm version: see above

CocoaPods version: 1.5.3

Steps to reproduce: download any file from valid link (having HTTPS!) using file-transfer cordova plugin fails with 401 error

Link to sample project: N/A

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
jcesarmobilecommented, Aug 26, 2019

You need both, the <access origin="*" /> and whitelist plugin.

3reactions
jcesarmobilecommented, Feb 6, 2019

Thanks for looking into it. In res/xml/ there is a config.xml, if you manually add the <access origin="*" /> there, does it work? If so I’ll just add it to the generated config.xml.

Read more comments on GitHub >

github_iconTop Results From Across the Web

File upload using cordova-plugin-file-transfer ... - Stack Overflow
I've connected my phone through cable to the laptop. To launch the app I typed in "Node.js-Command-Prompt" the command "ionic run Android". I've...
Read more >
Cordova File Transfer Plugin Fix - YouTube
How to fix the v 1.5.1 file-transfer - plugin build problem with Cordova Android 10.x.x. Only applies to versions of the integrated Alpha ......
Read more >
File upload using cordova-plugin-file-transfer not working on ...
File upload using cordova-plugin-file-transfer not working on Android devices - works only on iOS devices - ionic-v3 - Ionic Forum.
Read more >
cordova-plugin-file-transfer
This plugin defines global FileTransfer , FileUploadOptions constructors. Although in the global scope, they are not available until after the deviceready ...
Read more >
cordova-file-transfer Failing to upload to https server (Android ...
Post the question on the plugin issues board and ask them the simple question does https work under Android. 4. have a look...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found