“找不到 com_facebook_android.apk 错误”运行Android项目时
我已经在 Eclipse 中安装了适用于 Android 的 Facebook API,并将该项目导入到我的 Android 项目中。我的程序构建得非常好,但是当我尝试运行它时,我得到了
找不到 com_facebook_android.apk!
在构建窗口中,当程序实际尝试导入任何 Facebook API 类时,它会崩溃并显示 java.lang.NoClassDefFoundError: com.facebook.android.Facebook
I've installed the Facebook API for Android in Eclipse, and imported the project into my Android project. My program builds perfectly fine, but when I try to run it I get
Could not find com_facebook_android.apk!
in the build window, and when the program actually tries to import any of the Facebook API classes it blows up with a java.lang.NoClassDefFoundError: com.facebook.android.Facebook
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
可能您在“Java 构建路径”中添加了对 Java 项目的引用,但这是错误的位置。
根据 Android 指南:
要添加对库项目的引用,请执行以下步骤:
这解决了我的问题。
Probably you added the reference to the Java project in the "Java Build Path" but it's the wrong place.
From the Android guide:
To add a reference to a library project, follow these steps:
This resolved my problem.
在此处查看引用库说明:
http://developer.android.com/guide/developing/projects/projects -eclipse.html
确保您拥有最新版本的 ADT。
尝试在 Eclipse 中清理您的项目。
希望这有帮助
Check out referencing libraries instructions here:
http://developer.android.com/guide/developing/projects/projects-eclipse.html
Make sure you have the latest versions of ADT.
Try to clean your project in eclipse.
Hope this helps
就我而言,没有在引用的项目中检查
Is Library
(项目属性 > Android)
In my case helped, not to have in the referenced projects checked
Is Library
(Project Properties > Android)
我也遇到了这个错误的问题,并且注意到如果我以 root 身份运行 eclipse,那么错误就会消失。这让我认为这是一个权限问题
所以来帮忙:
在 com Facebook android 项目上右键单击>安卓工具>构建和导出
然后只需将项目构建到 Facebook 项目的 bin 文件夹中即可。
问题解决了
I am also having issues with this error and have noted that if I run eclipse as root then the error disappears. This makes me think it is a permissions issue
So to help:
On the com Facebook android project right click > android tool > build and export
Then simply build the project into the bin folder of the Facebook project.
Problem solved
我有类似的问题。这是我的决心。我必须添加 android.jar 作为参考。
Android 示例错误
I had a similar problem. This was my resolution. I had to add android.jar as a reference.
Android samples error
如果不起作用,请尝试删除 Android 版 Facebook 应用程序(如果您的手机上安装了该应用程序)。这对我有用。
If nothing works, try deleting the Facebook application for Android (if you have one installed on your phone). This worked for me.