“找不到 com_facebook_android.apk 错误”运行Android项目时

发布于 2024-12-02 05:02:36 字数 294 浏览 8 评论 0原文

我已经在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

空名 2024-12-09 05:02:36

可能您在“Java 构建路径”中添加了对 Java 项目的引用,但这是错误的位置。

根据 Android 指南:

要添加对库项目的引用,请执行以下步骤:

  • 在 Package Explorer 中,右键单击依赖项目并选择 Properties。
  • 在“属性”窗口中,选择左侧的“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:

  • In the Package Explorer, right-click the dependent project and select Properties.
  • In the Properties window, select the "Android" properties group at left and locate the Library properties at right.
  • Click Add to open the Project Selection dialog.
  • From the list of available library projects, select a project and click OK.
  • When the dialog closes, click Apply in the Properties window.
  • Click OK to close the Properties window

This resolved my problem.

放我走吧 2024-12-09 05:02:36
  1. 在此处查看引用库说明:
    http://developer.android.com/guide/developing/projects/projects -eclipse.html

  2. 确保您拥有最新版本的 ADT。

  3. 尝试在 Eclipse 中清理您的项目。

希望这有帮助

  1. Check out referencing libraries instructions here:
    http://developer.android.com/guide/developing/projects/projects-eclipse.html

  2. Make sure you have the latest versions of ADT.

  3. Try to clean your project in eclipse.

Hope this helps

同展鸳鸯锦 2024-12-09 05:02:36

就我而言,没有在引用的项目中检查 Is Library

(项目属性 > Android)

未选中“是库”的示例图像

In my case helped, not to have in the referenced projects checked Is Library

(Project Properties > Android)

sample image with "Is Library" unchecked

吃素的狼 2024-12-09 05:02:36

我也遇到了这个错误的问题,并且注意到如果我以 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

绝影如岚 2024-12-09 05:02:36

我有类似的问题。这是我的决心。我必须添加 android.jar 作为参考。

Android 示例错误

I had a similar problem. This was my resolution. I had to add android.jar as a reference.

Android samples error

梦里人 2024-12-09 05:02:36

如果不起作用,请尝试删除 Android 版 Facebook 应用程序(如果您的手机上安装了该应用程序)。这对我有用。

If nothing works, try deleting the Facebook application for Android (if you have one installed on your phone). This worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文