Reputation: 187
I created a small Cordova Plugin added it to my test app. In plugin.xml I set min cordova version to 3.4.0:
<engines>
<engine name="cordova" version=">=3.4.0"/>
</engines>
In my plugin JAVA class I import the PluginResult package:
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
And I create a "PluginResult" object:
PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
When I build the app I get the error that not found symbol:
error: cannot find symbol PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
error: package PluginResult does not exist
Can anyone help me?
Upvotes: 1
Views: 2503
Reputation: 187
I found my mistake ... It's missing an import line:
import org.apache.cordova.PluginResult;
Upvotes: 1
Reputation: 2956
It will be hard to locate the error when you don't post the full source code.
Anyway, the plugin structure requires so many files that your best approach to create a plugin is to use a sample plugin as base.
Check out the cordova-plugin-hello sample, you can download it and start editing everything accordingly to your needs.
After installing the sample plugin, test it by adding this code to your app:
var success = function(message) {
alert(message);
}
var failure = function() {
alert("Error calling Hello Plugin");
}
hello.greet("World", success, failure);
Then, everytime you make a change to the plugin, uninstall and reinstall it into your app to ensure your changes have worked.
Upvotes: 1