简体   繁体   English

运行Facebook官方示例时出现NoClassDefFoundError

[英]NoClassDefFoundError when running Facebook official example

Sorry I am new, stackoverflow does not allow me to post image and links... 对不起我是新手,stackoverflow不允许我发布图片和链接...

I try to use Official Android SDK ( http://github.com/facebook/facebook-android-sdk/ ). 我尝试使用官方Android SDK( http://github.com/facebook/facebook-android-sdk/ )。 I install the SDK and try to run the Example 我安装SDK并尝试运行示例

At first, it fails at "build", it cannot find the Facebook SDK, so I try to follow the steps found in SDK page: 首先,它在“构建”失败,它找不到Facebook SDK,所以我尝试按照SDK页面中的步骤进行操作:

Add a dependency on the Facebook Android SDK library on your application: 在您的应用程序上添加Facebook Android SDK库的依赖项:

  1. from the File menu, select "Properties" 从“文件”菜单中选择“属性”
  2. once the project Properties are displayed, open the Android section, which should list the build targets and libraries 显示项目属性后,打开Android部分,该部分应列出构建目标和库
  3. in the bottom "Library" section, click "Add..." and select the Facebook SDK project 在底部的“库”部分中,单击“添加...”并选择Facebook SDK项目
  4. refer to http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject for more details 有关详细信息,请参阅http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject

I check the link at #4, it shows a Mac OS X version Eclipse, which has Library section, but on my Vista PC, with Eclipse 3.5.2, it does not have Library section... 我查看了#4的链接,它显示了一个Mac OS X版本Eclipse,它有Library部分,但在我的Vista PC上,使用Eclipse 3.5.2,它没有Library部分......

- http://developer.android.com/images/developing/adt-props-isLib.png - http://developer.android.com/images/developing/adt-props-isLib.png

- http://farm5.static.flickr.com/4138/4852346022_fc8f6bedbe_b.jpg - http://farm5.static.flickr.com/4138/4852346022_fc8f6bedbe_b.jpg

I try to add the Facebook SDK in Java Build Path. 我尝试在Java Build Path中添加Facebook SDK。 Now it can "build" and start, on both Emulator and Device. 现在它可以在模拟器和设备上“构建”并启动。 However, once it started, it crash, the logcat shows: 然而,一旦它启动,它崩溃,logcat显示:

ERROR/AndroidRuntime(518): java.lang.NoClassDefFoundError: com.facebook.android.Util ERROR / AndroidRuntime(518):java.lang.NoClassDefFoundError:com.facebook.android.Util

- http://farm5.static.flickr.com/4138/4852346048_f4a3b998a3_b.jpg ) - http://farm5.static.flickr.com/4138/4852346048_f4a3b998a3_b.jpg

I searched around, about "NoClassDefFoundError" program, but seems those solution is solving external JARs files. 我四处搜索了“NoClassDefFoundError”程序,但似乎那些解决方案正在解决外部JAR文件。 I have no problem adding other JARs files, and this Facebook SDK is not JAR... 我没有添加其他JAR文件的问题,这个Facebook SDK不是JAR ...

I tried Clean, rebuild, delete everything and config again, but can't solve this problem yet. 我尝试了清理,重建,删除所有内容并重新配置,但还不能解决这个问题。

Anyone have idea please help, Thanks. 任何人都有想法请帮助,谢谢。

This exception is thrown if a class could not be found at runtime even if it was available when the program was compiled. 如果在运行时找不到类,即使在编译程序时它可用,也会抛出此异常。 You need to double check that the SDK jars are available to then program in the launch configuration. 您需要仔细检查SDK jar是否可用,然后在启动配置中进行编程。 This includes the jars being physically present ón the device. 这包括罐子实际存在于设备中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM