5 Replies Latest reply on Sep 27, 2016 3:36 AM by yorrd

    Relative URIs not supported - with an absolute URI


      I'm trying to achieve something alone these lines, downloading a file.


      new FileTransfer().download(
         (entry) => {
        console.log("done downloading to " + entry.toURL());
         true, // trustAllHosts
         {headers: {}}


      Testing is done on Android using the newest version of cordova, the file plugin and the file transfer plugin.


      The error (which I assume is because of the file path "cdvfile://localhost.../") is as follows


      E/PluginManager( 7657): Uncaught exception from plugin

      E/PluginManager( 7657): java.lang.IllegalArgumentException: Relative URIs are not supported.

          E/PluginManager( 7657):     at org.apache.cordova.CordovaResourceApi.assertNonRelative(CordovaResourceApi.java:452)

      E/PluginManager( 7657):     at org.apache.cordova.CordovaResourceApi.remapUri(CordovaResourceApi.java:135)

      E/PluginManager( 7657):     at org.apache.cordova.filetransfer.FileTransfer.download(FileTransfer.java:743)

      E/PluginManager( 7657):     at org.apache.cordova.filetransfer.FileTransfer.execute(FileTransfer.java:185)

      E/PluginManager( 7657):     at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)

      E/PluginManager( 7657):     at org.apache.cordova.PluginManager.exec(PluginManager.java:133)

      E/PluginManager( 7657):     at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)

      E/PluginManager( 7657):     at org.crosswalk.engine.XWalkExposedJsApi.exec(XWalkExposedJsApi.java:40)

      E/PluginManager( 7657):     at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)

      E/PluginManager( 7657):     at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:37)

      E/PluginManager( 7657):     at android.os.Handler.dispatchMessage(Handler.java:102)

      E/PluginManager( 7657):     at android.os.Looper.loop(Looper.java:135)

      E/PluginManager( 7657):     at android.os.HandlerThread.run(HandlerThread.java:61)


      (from the adb logcat)


      I can't make any sense out of this because until now I believed, that the URI for the target directory I'm using, in fact IS an absolute one. Also, the docs suggest using the function just like I did.


      Thanks for any advice.

        • 1. Re: Relative URIs not supported - with an absolute URI
          kerrishotts Adobe Employee

          What version of Android are you testing on?


          Also, what does `downloadPath` look like?

          • 2. Re: Relative URIs not supported - with an absolute URI
            VectorP Level 4

            ...and what file-transfer plugin are you using (the file plugin is integrated and thus not separately needed)?

            It looks like you're using ancient plugins from the pgb repo.

            • 3. Re: Relative URIs not supported - with an absolute URI
              yorrd Level 1

              Android version is 5 (vanilla) with the crosswalk renderer. I thought there are no differences o.o


              downloadPath = "http://domain.com:12345/download/zipped/test.zip"

              • 4. Re: Relative URIs not supported - with an absolute URI
                yorrd Level 1

                I'm using meteor and added the plugin doing "meteor add cordova:cordova-plugin-file-transfer@1.6.0" and "cordova:cordova-plugin-file@4.3.0" which - to my knowledge - ist the last version, updated just 2 weeks ago.


                Until two minutes ago I didn't even know that there is a pgb repo

                • 5. Re: Relative URIs not supported - with an absolute URI
                  yorrd Level 1

                  VectorP kerrishotts


                  I just found this in the build logs when building the Android application. Is it related?



                  %% "cordova-plugin-compat" is required by (cordova-plugin-file) and cannot be removed (hint: use -f or --force) and cannot be removed (hint: use -f or --force)



                  (node) warning: possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit.


                      at TLSSocket.addListener (events.js:239:17)

                      at TLSSocket.Readable.on (_stream_readable.js:680:33)

                      at Request.<anonymous> (/home/git/.meteor/packages/meteor-tool/.1.4.1_1.275oit++os.linux.x86_64+web.browser+web. cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/cordova-lib/node_modules/npm/node_m odules/npm-registry-client/lib/request.js:153:7)

                      at emitOne (events.js:77:13)

                      at Request.emit (events.js:169:7)

                      at ClientRequest.<anonymous> (/home/git/.meteor/packages/meteor-tool/.1.4.1_1.275oit++os.linux.x86_64+web.browser+web. cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/cordova-lib/node_modules/npm/node_m odules/request/request.js:791:10)

                      at emitOne (events.js:82:20)

                      at ClientRequest.emit (events.js:169:7)

                      at tickOnSocket (_http_client.js:523:7)

                      at onSocketNT (_http_client.js:535:5)

                      at nextTickCallbackWith2Args (node.js:442:9)

                      at process._tickCallback (node.js:356:17)