我创建了一个android应用程序(phonegap 2.0)并安装了插件:https://github.com/mgcrea/cordova-facebook-connect
这一行:res/xml/config.xml。facebook-android-sdk.jar位于libs/下,并添加到build path中。
我的资产/www/包含:https://github.com/mgcrea/cordova-facebook-connect/tree/master/samples/ios/www
当我编译它并在我的Samsung 2.3 Infuse 4G上运行时,我得到:I/InputReader( 139): dispatchTouch::touch event's action is 1I/InputDispatcher( 139): Delivering touch to current input target: action: 1, channel '40812958 com.example.milea/com.example.milea.MainActivity (server)'V/webview (20224): singleCursorHandlerTouchEvent -getEditableSupport FASLEW/System.err(20224): java.lang.ClassNotFoundException: org.apache.cordova.plugins.FacebookConnectW/System.err(20224): at java.lang.Class.classForName(Native Method)W/System.err(20224): at java.lang.Class.forName(Class.java:234)W/System.err(20224): at java.lang.Class.forName(Class.java:181)W/System.err(20224): at org.apache.cordova.api.PluginEntry.getClassByName(PluginEntry.java:103)W/System.err(20224): at org.apache.cordova.api.PluginEntry.createPlugin(PluginEntry.java:78)W/System.err(20224): at org.apache.cordova.api.PluginManager.getPlugin(PluginManager.java:255)W/System.err(20224): at org.apache.cordova.api.PluginManager.exec(PluginManager.java:182)W/System.err(20224): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:207)W/System.err(20224): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:602)W/System.err(20224): at android.os.Handler.dispatchMessage(Handler.java:99)W/System.err(20224): at android.os.Looper.loop(Looper.java:130)W/System.err(20224): at android.app.ActivityThread.main(ActivityThread.java:3687)W/System.err(20224): at java.lang.reflect.Method.invokeNative(Native Method)W/System.err(20224): at java.lang.reflect.Method.invoke(Method.java:507)W/System.err(20224): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)W/System.err(20224): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)W/System.err(20224): at dalvik.system.NativeStart.main(Native Method)W/System.err(20224): Caused by: java.lang.NoClassDefFoundError: org.apache.cordova.plugins.FacebookConnectW/System.err(20224): ... 17 moreW/System.err(20224): Caused by: java.lang.ClassNotFoundException: org.apache.cordova.plugins.FacebookConnect in loader dalvik.system.PathClassLoader[/data/app/com.example.milea-2.apk]W/System.err(20224): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)W/System.err(20224): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)W/System.err(20224): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)W/System.err(20224): ... 17 moreI/System.out(20224): Error adding plugin org.apache.cordova.plugins.FacebookConnect.D/CordovaLog(20224): Error: Status=2 Message=Class not foundD/CordovaLog(20224): file:///android_asset/www/js/cordova-2.0.0.js: Line 938 : Error: Status=2 Message=Class not foundI/Web Console(20224): Error: Status=2 Message=Class not found at file:///android_asset/www/js/cordova-2.0.0.js:938D/CordovaLog(20224): facebookConnect.login:"Class not found"D/CordovaLog(20224): file:///android_asset/www/js/plugin.js: Line 5 : facebookConnect.login:"Class not found"I/Web Console(20224): facebookConnect.login:"Class not found" at file:///android_asset/www/js/plugin.js:5D/Cordova (20224): onPageFinished(file:///android_asset/www/index.html#)D/CordovaWebView(20224): >>> loadUrlNow()D/DroidGap(20224): onMessage(onNativeReady,null)
最佳答案
它正在寻找您的facebookconnect类位于org.apache.cordova.plugins名称空间中。仔细检查facebookconnect.java文件顶部为包设置的内容。