简体   繁体   English

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

[英]“could not find com_facebook_android.apk error” when running Android project

I've installed the Facebook API for Android in Eclipse, and imported the project into my Android project. 我在Eclipse中安装了Facebook的Android API,并将项目导入我的Android项目。 My program builds perfectly fine, but when I try to run it I get 我的程序构建完美,但是当我尝试运行它时,我得到了

Could not find com_facebook_android.apk! 找不到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 在构建窗口中,当程序实际上尝试导入任何Facebook API类时,它会java.lang.NoClassDefFoundError: com.facebook.android.Facebook

Probably you added the reference to the Java project in the "Java Build Path" but it's the wrong place. 您可能在“Java Build Path”中添加了对Java项目的引用,但这是错误的地方。

From the Android guide: 来自Android指南:

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. 在“属性”窗口中,选择左侧的“Android”属性组,然后在右侧找到“库”属性。
  • 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. 这解决了我的问题。

In my case helped, not to have in the referenced projects checked Is Library 在我的情况下帮助,没有在引用的项目中检查Is Library

(Project Properties > Android) (项目属性> Android)

未选中“Is Library”的示例图像

  1. Check out referencing libraries instructions here: 在这里查看引用库指令:
    http://developer.android.com/guide/developing/projects/projects-eclipse.html http://developer.android.com/guide/developing/projects/projects-eclipse.html

  2. Make sure you have the latest versions of ADT. 确保您拥有最新版本的ADT。

  3. Try to clean your project in eclipse. 尝试在eclipse中清理你的项目。

Hope this helps 希望这可以帮助

I am also having issues with this error and have noted that if I run eclipse as root then the error disappears. 我也遇到了这个错误的问题,并注意到如果我以root身份运行eclipse,那么错误就会消失。 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 在Facebook Facebook项目右键单击> android工具>构建和导出

Then simply build the project into the bin folder of the Facebook project. 然后只需将项目构建到Facebook项目的bin文件夹中。

Problem solved 问题解决了

I had a similar problem. 我遇到了类似的问题。 This was my resolution. 这是我的决议。 I had to add android.jar as a reference. 我不得不添加android.jar作为参考。

Android samples error Android示例错误

If nothing works, try deleting the Facebook application for Android (if you have one installed on your phone). 如果无效,请尝试删除Android的Facebook应用程序(如果手机上已安装了该应用程序)。 This worked for me. 这对我有用。

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

相关问题 Android Eclipse-找不到* .apk - Android Eclipse - Could not find *.apk Gradle Error无法在Android Studio中找到com.actionbarsherlock:actionbarsherlock:4.4.0与Eclipse导出的项目 - Gradle Error Could not find com.actionbarsherlock:actionbarsherlock:4.4.0 with Eclipse exported project in Android Studio “找不到mopub-android-sdk.apk!” - “Could not find mopub-android-sdk.apk!” 将Facebook SDK添加到android项目时出错 - Error when Facebook sdk Added into android project 启动工作室时出错:安装 Android Studio 时“找不到主类 com/intellij/idea/Main” - Error launching studio: "Could not find main class com/intellij/idea/Main" when installing Android studio 错误:找不到 com.android.tools.build:gradle:3.5.2 - ERROR: Could not find com.android.tools.build:gradle:3.5.2 错误:找不到 com.android.tools.build:gradle:3.5.3 - Error : Could not find com.android.tools.build:gradle:3.5.3 在Android项目中放置并运行apk文件 - placing and running apk file inside android project Android Studio: Could not find com.android.tools.build:gradle:3.6.2 during import an Eclipse project - Android Studio: Could not find com.android.tools.build:gradle:3.6.2 during import an Eclipse project Android Java Googlemap找不到android-mapviewballoons.apk - Android Java Googlemap Could not find android-mapviewballoons.apk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM