简体   繁体   中英

Phonegap Android App : FileUploader shows error

I am trying to integrate " FileUploader " into my android phonegap app.

I copied "FileUploader.java" into com.beetight as says in the above post.

public class FileUploader extends Plugin {

The above line shows error: "Plugin cannot be resolved to a type"

@Override
public PluginResult execute(String action, JSONArray args, String callbackId) {

Code shows error: "the method execute (String JSONArray, String) of type FileUploader must override or implement a super type method".

I have no idea how can i resolve these errors.

Please help, Thanks

With the updated PhoneGap/Cordova API, Plugin was deprecated for extending the API. You'll need to extend "CordovaPlugin" now instead of just "Plugin"

In turn you'll also need to import org.apache.cordova.api.CordovaPlugin now instead too.

Also, the execute method that needs to be overridden also has a new setup, which is caleld with

public boolean execute(String action, JSONArray data, CallbackContext callbackContext) { }

So it's no longer PluginResult return type.

There are some additional things you need to import. I had this same problem too, but this blog post helped me a lot on it and I got my custom plugins to work: http://simonmacdonald.blogspot.com/2013/06/why-dont-my-plugins-work-in-phonegap.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM