I am trying to write a plugin for my android phonegap application. I wrote the java class and the javascript items. When I was finished I took the java class file and added it to myEclipseProject/platforms/android/src/com/example/playSound/playSoundPlugin.java
I then opened up myEclipseProject/platforms/android/res/xml/config.xml and added the following lines
<Feature name="playSound">
<param name="android-package" value="com.example.playSound.playSoundPlugin" />
</Feature>
Whenever I try to call this plugin i get: Call to Unknown Plugin: playSoundPlugin
What am i missing? Please help. Thaks
Turns out I'm an idiot. tag should be all lower case!! hope this helps someone in the future.
I installed the FacebookConnect plugin into my cordova project with the code:
cordova -d plugin add /Users/your/path/here/phonegap-facebook-plugin --variable APP_ID="123456789" --variable APP_NAME="myApplication"
Then linked the Facebook API (3.8.0) in /platforms/android/project.properties with:
android.library.reference.2=../../facebook-android-sdk-3.8.0/facebook
Then copied the example 'Simple' into the /www folder, added my app id and changed phonegap.js to cordova.js.
When I compile and run the application on my android phone I receive the following errors:
Cordova Facebook Connect plugin fail on init
Cordova Facebook Connect plugin fail on auth.status
and on login:
Cordova Facebook Connect plugin fail on login!Class not found
LogCat gives the following error:
exec() call to unknown plugin: org.apache.cordova.facebook.Connect
I've scoured the internet but cannot find a solution to this problem.
I did notice that my /platforms/android/res/xml/config.xml file lists the plugin as:
<feature name="FacebookConnectPlugin">
<param name="android-package" value="org.apache.cordova.facebook.ConnectPlugin" />
</feature>
When the Documentation says that it should be:
<feature name="org.apache.cordova.facebook.Connect">
<param name="ios-package" value="FacebookConnectPlugin" />
</feature>
But I can't change this as it's automatically generated during the compiling process.
Did you remember to copy (from the download) www/cdv-plugin-fb-connect.js, www/facebook-js-sdk.js into your apps www folder?
I got the same error, managed to fix by updating my root config.xml (which isn't generated) to include:
<feature name="org.apache.cordova.facebook.Connect">
<param name="android-package" value="org.apache.cordova.facebook.ConnectPlugin" />
</feature>
(Note android-package as looks like you are using android.)
This is under the manual install section of the readme, but also seems to be necessary after following the automatic install process.
Now you can execute cordova build android from the root, bob's your uncle.
As of 6/13/14 this is what works for me, so I laid out my steps on PasteBin.
http://pastebin.com/WvQvqx6U
Basically just reverted back to 0.4.0 of Facebook Connect.
It's working perfectly for me, and I didn't have any issues setting it up.
I am trying to build the Hello world example which comes along with phonegap-2.9.1 (phonegap-2.9.1\lib\android\example) in Eclipse. I get the app launched but when I click on "Capture Photo" It gives me following error -
file:///android_asset/www/index.html: Line 67 : Uncaught TypeError: Cannot call method 'getPicture' of undefined", source: file:///android_asset/www/index.html (67)
I have HelloWorld-CordovaLib project as well which is included as Lib in "Hello World" example so I don't need to build the cordova.jar
Another request, I am feeling its difficult to get started easily with phonegap. If you can point me to some good sites (other than phonegap itself) where I can plugin myself with phonegap community that would be helpful.
Have you installed camera plugin, set all the permissions in AndroidManifest.xml & add the following code in config.xml?
<feature name="Camera">
<param name="android-package" value="org.apache.cordova.camera.CameraLauncher" />
</feature>
I use phonegap to develop an app. This app works with some apis so, i have to use inappbrowser plugin. But after phonegap 2.9.x versions, the plugin's events are not firing. You can look at this problem on this forum https://groups.google.com/forum/#!topic/phonegap/e5_5unC2fYs
. Apache has an announcement about it.announcement But it is not a solve. Because, when i try to use phonegap with dreamweaver, i can choose phonegap 2.9 version in Dreamweaver Build service and Inappbrowser events work on Android 4.x devices. So, the problem is not about Android version. The problem is about Phonegap version. For some sdks(admob,...) i have to use eclipse. And i cant create a Phonegap 2.9 version app with command line. Do you have any idea about to choose version when creating app. Or change downgrade phonegap version.
Thanks for you answers.
I haven't tested it myself, but if you're using phonegap build, you can try to include plugins in this format:
<gap:plugin name="org.apache.cordova.inappbrowser" />
, as well as the documented:
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser" />
</feature>
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser" />
</feature>
see this page for plugin details
I had some trouble upgrading from 2.9.0 to 3.3.0, and it turns out I included my plugins in this format:
<plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser" />
, which for some reason didn't work, when I used the format my plugins started working again.
Hope this helps.
It turns out that my issue was not that the events weren't firing, but that there was a bug in my callback code (a ReferenceError). Since this callback was the first callback to be run when the InAppBrowser received a "loadstart" event, all future callbacks did not run since the first callback raised an exception, making it seem like the InAppBrowser wasn't firing any callbacks at all.
The way I found this was actually by manually evaluating the callback in weinre.
cordova.require('cordova/exec').nativeCallback('InAppBrowser115751764',1,
{
"url" : "http:\/\/example.com\/path",
"type" : "loadstart"
}
,1)
I got the above snippet by reviewing the verbose PhoneGap exec logs. You should also be able to find the callback ID by inspecting the cordova.callbacks object.
Try install cordova:
sudo npm install -g cordova
install plugin inappbrowser:
cordova plugin add org.apache.cordova.inappbrowser
now run:
phonegap run android
I followed the tutorial of Phonegap from the official Phonegap.com site (getting started with Android).
I have created project with following all the steps.
created activity and extended from "DroidGap" and added loadURL method from onCreate().
Added cordova-2.0.0.js and cordova-2.0.0.jar on the respective folder.
Added the jar file to the build path
Loaded the js file from the html tag
Added permissions from AndroidMainfeast.xml
copied the xml folder containing "configs.xml"
Now I don't understand where's the problem. It is showing the below error as shown in the screenshot
Here is my HTML file
<!DOCTYPE html>
<html>
<head>
<title>Notification Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
// Empty
}
// Show a custom alert
//
function showAlert() {
navigator.notification.alert(
'You are the winner!', // message
'Game Over', // title
'Done' // buttonName
);
}
// Beep three times
//
function playBeep() {
navigator.notification.beep(3);
}
// Vibrate for 2 seconds
//
function vibrate() {
navigator.notification.vibrate(2000);
}
</script>
</head>
<body>
<p>Show Alert</p>
<p>Play Beep</p>
<p>Vibrate</p>
</body>
</html>
Any advice? Thanks!
It is config.xml not configs.xml.
Based on the logs I'm seeing you are missing this file in your apps res/xml directory. It is included as part of the distribution at lib/android/res/xml/config.xml so copy that file into your res/xml directory and you should be all set.
Just as aharris88 in his answer to this question, I had the [CORDOVA] Error initilizing Cordova: Class not found error message when using Cordova 3.1.0 on my Android dev phone after migrating from Phonegap 3.0.
All fiddling with the config.xml file in the /platforms/android/res/xml directory did not help. Based on the Stackoverflow answer mentioned above, I tried to "start over" by reinstalling Android platform support:
cordova platform rm android
cordova platform add android
After this step it worked again, and I was able to cordova build android && cordova run android without any further problems.
I have had this error because of a plugin that I deleted. I Added
<plugin name="Device" value="org.apache.cordova.Device"/>
to the config.xml file again and it fixed it.
My you not have following plugin:
<plugin name="Device" value="org.apache.cordova.Device"/>
You have to put that in between <plugins></plugins>.
like
<plugins>
<plugin name="Device" value="org.apache.cordova.Device"/>
</plugins>
Well,the error I found is:
05-28 08:19:53.139: E/PluginManager(1478): =====================================================================================
05-28 08:19:53.139: E/PluginManager(1478): ERROR: config.xml is missing. Add res/xml/config.xml to your project.
05-28 08:19:53.139: E/PluginManager(1478): https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/res/xml/plugins.xml
but I found /res/xml/config.xml in my project
finally,I found error in org.apache.cordova.api.PluginManager:
public void loadPlugins() {
int id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getClass().getPackage().getName());
...
should change to:
public void loadPlugins() {
int id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getPackageName());
...
you could read more about the method "getIdentifier(String name, String defType, String defPackage)" in offical doc
I had this problem using phonegap 3.x and the problem turned out to be that phonegap hadn't properly installed the plugins, or they just messed up along the way. Basically when you install the plugins and build for a platform it takes the javascript files from plugins/org.apache.cordova.core.specific-plugin/www and puts them in platforms/android/assets/www/plugins/org.apache.cordova.core.specific-plugin/www and then it takes the Java files (or objective C for iOS) and puts them in platforms/android/src/org/apache/cordova/specificplugin
And all of this is specified by plugins/org.apache.cordova.core.specific-plugin/plugin.xml. If you look in a plugins.xml you should see something like:
<source-file src="src/android/NetworkManager.java" target-dir="src/org/apache/cordova/networkinformation" />
So this tells you that in platforms/android/src/org/apache/cordova/networkinformation, there should be NetworkManager.java. And that file can be copied from plugins/org.apache.cordova.core.network-information/src/android/NetworkManager.java
Now all of this is supposed to happen automatically without having to touch the platforms folder. But if it messes up you can fix it by manually copying the correct files into the correct folders.
You can resolve this when using phonegap command line by doing the following:
Delete merges/android, platforms/android, plugins/android.json
run phonegap local build android
Had same problem with Class not found. One problem to look at is to ensure that the android.json (or ios.json) file is being updated on a build. Mine was effectively empty.
Also, remove and add back the plugins as mentioned in some other posts.
Finally, the thing that worked for me was to ensure that the plugins were corrected referenced in the config.xml:
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device"/>
</feature>
<feature name="Camera">
<param name="android-package" value="org.apache.cordova.camera.CameraLauncher"/>
</feature>
<feature name="Notification">
<param name="android-package" value="org.apache.cordova.dialogs.Notification"/>
</feature>
Note the double naming of 'device.Device' and also the sub-classing of the 'camera' and 'dialogs' plugins. This just isn't properly referenced by the Phonegap documentation.
So After near to kill myself , i found that i was using cordova version 5.3.3 and cordova-android version 5.0.0, somehow i don't know may be there are not compatible or there can be a bug ,so i fall back to cordova android 4.1.1
cordova platform rm android
cordova platform add android#4.1.1
and this saved me up
I ran into the same error: "Error initializing Cordova: Class not found", using cordova with visual studio 2015. But this wasn't the only error, none of my plugins seem to get trough. I've tried about EVERYTHING. From cordova platform rm/add android x1000 times, to deleting and re-adding the plugins manually, nothing seem to do the trick.
Then i changed my cordova-cli in the taco.json file from 5.3.3 to 5.4.0 and ran it on my device. Finally this fixed the whole issue for me. I then downgraded the cordova version back to 5.3.3 ( the 5.4.0 version is not supported by the adb bridge as of yet ). Try it out!
I'm getting the same error, I checked my Cordova plugin list
by running the command "cordova plugin list" in my Android project directory and found "org.apache.cordova.device" plugin missing.
I updated it using "Cordova plugin add cordova-plugin-device" and Error was gone.
[Solved in my case]
First, step six is wrong: it is config.xml and not configs.xml
I have the same error despite I have my config.xml in res/xml folder.
It is because you have to install manually plugins for basic API functions.
Through console navigate to your project folder and type:
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
You can read more here in phonegap Doc (last section called add features) : Phonegap Doc
I leave you also my config.xml file
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.helloCordova" version="2.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name short="Menu">Menu Digital</name>
<description>
Description
</description>
<author email="asd#gmail.com" href="www.facebook.com/usr"> Name </author>
<feature name="App">
<param name="android-package" value="org.apache.cordova.App" />
</feature>
<feature name="http://api.phonegap.com/1.0/device" />
<feature name="http://api.phonegap.com/1.0/media" />
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<content src="index.html" />
<feature name="App">
<param name="android-package" value="org.apache.cordova.App" />
</feature>
<access origin="*" />
<preference name="useBrowserHistory" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
</widget>
This could happened 'cause your cordova plugin have a different path from what IONIC expect to found:
You should correct the file plugin.xml inside your plugin source folder:
<config-file target="app/src/main/res/xml/config.xml" parent="/*">
should be:
<config-file target="res/xml/config.xml" parent="/*">
If you try to searching that error inside the Android Studio Logcat usually you find something like:
io.ionic.starter E/chromium: [ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: blink::mojom::BudgetService exposed by: content_browser
2019-02-22 13:40:06.144 30230-30258/com.android.webview:sandboxed_process0 E/chromium: [ERROR:BudgetService.cpp(167)] Unable to connect to the Mojo BudgetService.