-->

Phonegap 3 - Android Plugin not working

2019-08-07 06:48发布

问题:

I have developed a custom phonegap plugin for android -

https://github.com/bharatkaushik/AndroidEstimoteBeacons

I have placed my plugin folder, within my project's Phonegap's plugin folder.

My project's config.xml entry for this plugin is as follows:

 <feature name="EstimoteBeacons">
    <param name="android-package" value="org.bkaushik.estimotebeacons" />
    <param name="onload" value="true" />
</feature>

I am not able to see my plugin's java files in my android project.

Also, when I try to see the list of plugins by typing phonegap local plugin list, I get an error that the project directory could not be found.

Am I missing anything here ?

Thanks! Bharat

回答1:

I'am using Sencha Cmd v4.0.2.67, sencha touch 2.3, phonegap 3.3.0. I'm also confusing about adding phonegap plugins, but i just find a way, maybe it can be some solutions. My solutions, is change the working directory to phonegap (i have sencha app and phogegap generated application). Then on that directory, just type plugin you want to add, in example:

tigalima:phonegap bee$ phonegap plugin add org.apache.cordova.network-information
[phonegap] adding the plugin: org.apache.cordova.network-information
[phonegap] successfully added the plugin

hope that works.



回答2:

Instead of placing your plugin in the plugins directory, move the files to a directory outside of your project root and run this command from your project root:

cordova plugin add /PATH/TO/YOUR/PLUGIN/FILES

This will add the files to your plugins directory AND to the correct locations for the platform files and JS file.



回答3:

Is estimotebeacons the java class file of your plugin which extends CordovaPlugin? If not, make sure to include the class file:

<feature name="EstimoteBeacons">
    <param name="android-package" value="org.bkaushik.estimotebeacons.ClassName" />
    <param name="onload" value="true" />
</feature>

and also make sure to add it on res/xml/Config.xml file.



回答4:

use this command this will help you and insure that you are doing in your project directory

$ phonegap local plugin add https://github.com/bharatkaushik/AndroidEstimoteBeacons