Home » Android » android – CordovaResourceApi import unresolved phonegap

android – CordovaResourceApi import unresolved phonegap

Posted by: admin April 23, 2020 Leave a comment

Questions:

I am using phonegap-2.9.0 with file plugin. When I build project for android platform it creates two packages within the src/ folder:

org.apache.cordova.file
org.apache.cordova.filetransfer

I get below errors within these two packages:

1 – org.apache.cordova.file.FileUtils

Method testSaveLocationExists() from the type DirectoryManager is not visible
Method getFreeDiskSpace() from the type DirectoryManager is not visible
Method testFileExists() from the type DirectoryManager is not visible

2 – org.apache.cordova.filetransfer.FileTransfer

import org.apache.cordova.CordovaResourceApi unresolved
import org.apache.cordova.CordovaResourceApi.OpenForReadResult unresolved

Could someone please tell me what I should do to resolve these?

Thanks.

How to&Answers:

You have two problems.

1) Version of Phonegap is outdated

2) The way to install a plugin is:

-> phonegap plugin add “urlofplugin” or “/path””

-> phonegap platform add android

-> phonegap prepare

-> phonegap build

sometimes the plugin has a different default installation, the files need to change the platform.

Answer:

Well, I dont know if I can help you, but I had similar problems. When I installed exactly those two plugins I got an error too. A different one, which I dont perticularly remember, something to do with a missing file that I can easily find in the file manager. Anyway, what helped me was:

  1. I updated to a more recent version, if you are able to I advice for it.
  2. After installing the plugins through cordova cmd api (.nodejs command prompt … you know what I mean) I was forgetting to build in the api itself. It sounds stupid but I was using wp8 and thus using a template for visual studio. The studio gave me the error, the building process (in cmd) also gave errors, but it was fixed by updating to the newer version.

Answer:

You need to configure you build path and then add library from external source and select the library then it will resolve or u can make copy and paste cordova library .jar file in your lib folder. then it will remove, if not happen then tell me …….

Answer:

I am not sure if that will work but first uninstall these plugins using phonegap/cordova CLI and than reinstall it in the root of application folder using the CLI only like this:

phonegap local plugin add <required plugin>

This worked for me after reinstallation.