Closed janhar closed 10 years ago
What commands did you use to install the plugin?
Hi John,
I strictly followed the getting started guide: $ cordova create foo com.example.foo Foo $ cd foo $ cordova platform add android $ cordova plugin add https://github.com/chariotsolutions/phonegap-nfc.git modified the index.js as described... $ cordova run android
Those steps look correct. I'll try and duplicate. Are you developing on Windows, Mac or Linux?
Mac. My test phone is a Samsung GT-S6500 (Android 2.3.6)
Hi Don, is it possible to reproduce the error?
@janhar I followed the getting started instructions with cordova-3.4.0-0.1.0 and everything worked as expected.
I expect this is related to Android 2.3.6. I'll see if I can track down an older phone with NFC.
Android 2.3.6 is the problem. The plugin implements NfcAdapter$OnNdefPushCompleteCallback which isn't in 2.3.6.
I/Web Console( 5665): Received Event: deviceready at file:///android_asset/www/js/index.js:70
I/dalvikvm( 5665): Failed resolving Lcom/chariotsolutions/nfc/plugin/NfcPlugin; interface 41 'Landroid/nfc/NfcAdapter$OnNdefPushCompleteCallback;'
W/dalvikvm( 5665): Link of class 'Lcom/chariotsolutions/nfc/plugin/NfcPlugin;' failed
W/System.err( 5665): java.lang.ClassNotFoundException: com.chariotsolutions.nfc.plugin.NfcPlugin
You could try and older version of the plugin that is Gingerbread compatible. Maybe v0.4.2
Alternately you could fork master, exit NfcPlugin so it no longer extends NfcAdapter$OnNdefPushCompleteCallback. There are other calls that need newer APIs but I think you're OK if you don't call push and handover methods.
@don Thank you very much! I'll take a look on it.
Btw. what is the current minimum API level on Android for the latest plug-in version?
Ideally android-16 (which I think is 4.1), but if you remove the listener and don't use the push methods 2.3.6 is fine.
Hi Don, I'm getting an exception when I do:
nfc.addNdefListener(app.onNFC, function(){ alert("Listener added..."); }, function(e){ alert("Error adding listener added..." + JSON.stringify(e)); });
The exception says: "Class not found", any ideas on how to get the plugin to work?
Using: phonegap 4.2.0-0.24.2 Samsung Galaxy S3 with Android 4.2.2
Thanks
Hi,
I receive the following exception when I run the plugin on Android 2.3.6:
D/CordovaLog( 1380): : Line 1203501237 : Received Event: deviceready I/Web Console( 1380): Received Event: deviceready at :1203501237 W/dalvikvm( 1380): Link of class 'Lcom/chariotsolutions/nfc/plugin/NfcPlugin;' failed W/System.err( 1380): java.lang.ClassNotFoundException: com.chariotsolutions.nfc.plugin.NfcPlugin W/System.err( 1380): at java.lang.Class.classForName(Native Method) W/System.err( 1380): at java.lang.Class.forName(Class.java:234) W/System.err( 1380): at java.lang.Class.forName(Class.java:181) W/System.err( 1380): at org.apache.cordova.PluginEntry.getClassByName(PluginEntry.java:117) W/System.err( 1380): at org.apache.cordova.PluginEntry.createPlugin(PluginEntry.java:93) W/System.err( 1380): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:278) W/System.err( 1380): at org.apache.cordova.PluginManager.execHelper(PluginManager.java:232) W/System.err( 1380): at org.apache.cordova.PluginManager.exec(PluginManager.java:227) W/System.err( 1380): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53) W/System.err( 1380): at android.webkit.JWebCoreJavaBridge.sharedTimerFired(Native Method) W/System.err( 1380): at android.webkit.JWebCoreJavaBridge.sharedTimerFired(Native Method) W/System.err( 1380): at android.webkit.JWebCoreJavaBridge.fireSharedTimer(JWebCoreJavaBridge.java:91) W/System.err( 1380): at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:108) W/System.err( 1380): at android.os.Handler.dispatchMessage(Handler.java:99) W/System.err( 1380): at android.os.Looper.loop(Looper.java:130) W/System.err( 1380): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:747) W/System.err( 1380): at java.lang.Thread.run(Thread.java:1019) W/System.err( 1380): Caused by: java.lang.NoClassDefFoundError: com.chariotsolutions.nfc.plugin.NfcPlugin W/System.err( 1380): ... 17 more W/System.err( 1380): Caused by: java.lang.ClassNotFoundException: com.chariotsolutions.nfc.plugin.NfcPlugin in loader dalvik.system.PathClassLoader[/data/app/com.example.foo-1.apk] W/System.err( 1380): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) W/System.err( 1380): at java.lang.ClassLoader.loadClass(ClassLoader.java:551) W/System.err( 1380): at java.lang.ClassLoader.loadClass(ClassLoader.java:511) W/System.err( 1380): ... 17 more I/System.out( 1380): Error adding plugin com.chariotsolutions.nfc.plugin.NfcPlugin. D/PluginManager( 1380): exec() call to unknown plugin: NfcPlugin
Additional information: Cordova Version: 3.3.1-0.4.2 Project (default): https://github.com/chariotsolutions/phonegap-nfc/blob/master/doc/GettingStartedCLI.md