Facebook SDK 导入到 Eclipse 无法解析 java/Android 导入
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20420050/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Facebook SDK import to Eclipse cannot resolve java/Android imports
提问by Ojonugwa Jude Ochalifu
I just imported the Facebook SDK to Eclipse, but the project FacebookSDK has some errors which i cannot fix.The project in the Project Explorer looks like this
我刚刚将 Facebook SDK 导入 Eclipse,但项目 FacebookSDK 有一些我无法修复的错误。项目资源管理器中的项目如下所示
But when i open a file, in this case AccessToken.java, it contains all these errors
但是当我打开一个文件时,在这种情况下 AccessToken.java,它包含所有这些错误
When i move my cursor over these errors, it says "the import...cannot be resolved".Am i missing something here?
当我将光标移到这些错误上时,它说“导入...无法解决”。我在这里遗漏了什么吗?
采纳答案by Piyush
You have to first import your Facebook-SDKto Eclipse.
你必须先导入您的Facebook-SDK到Eclipse中。
Now Add this Facebook-SDK library project to your Main Project.
现在将此 Facebook-SDK 库项目添加到您的Main Project。
Steps for that:
步骤:
Select Properties->Android->Select Project Build Target-> Add-> Apply->Ok.
选择 Properties-> Android-> Select Project Build Target-> Add-> Apply-> Ok。
After adding as a library project if you have indicated as a Green Mark that means your library project imported successfully otherwise red indicated it is not.
添加为库项目后,如果您已指示为绿色标记,则表示您的库项目已成功导入,否则红色表示未成功。
回答by Andrew Fielden
Have you set the Android target on your Facebook SDK project?
您是否在 Facebook SDK 项目中设置了 Android 目标?
Right click on the FacebookSDK project, select Properties, then click on 'Android'
右键单击 FacebookSDK 项目,选择属性,然后单击“Android”
Select one of the project build targets.
选择项目构建目标之一。
回答by Ashly
You need to mark the facebook sdk project as library in the project properties and after that goto to the properties of your project and add a reference project which is the imported facebook sdk
您需要在项目属性中将 facebook sdk 项目标记为库,然后转到项目的属性并添加一个引用项目,该项目是导入的 facebook sdk
回答by user1803558
Use that link to download https://github.com/facebook/facebook-android-sdk/archive/master.zip
使用该链接下载 https://github.com/facebook/facebook-android-sdk/archive/master.zip
After, get all jars into lib folder.
之后,将所有 jars 放入 lib 文件夹。