git 将 facebook-android-sdk 导入 eclipse 的困难

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8375211/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:13:48  来源:igfitidea点击:

difficulty in importing the facebook-android-sdk into eclipse

androideclipsefacebookgit

提问by george

I try to follow the facebook-android tutorial from here: https://developers.facebook.com/docs/mobile/android/build/#sampleI am working in windows 7. I have installed the Git and cloned the GitHub repository running this command in the git Bash -> git clone git://github.com/facebook/facebook-android-sdk.git

我尝试从这里遵循 facebook-android 教程:https: //developers.facebook.com/docs/mobile/android/build/#sample我在 Windows 7 中工作。我已经安装了 Git 并克隆了正在运行的 GitHub 存储库这个命令在 git Bash -> git clone git://github.com/facebook/facebook-android-sdk.git

Everything seemed fine and I got the folder “facebook-android-sdk” in my “Users” folder.

一切似乎都很好,我在“用户”文件夹中找到了“facebook-android-sdk”文件夹。

But when I try to import the project in eclipse workspace so to use it as a library I cannot make it work. I've tried 3 things:

但是当我尝试在 eclipse 工作区中导入项目以便将其用作库时,我无法使其工作。我尝试了 3 件事:

  1. Create the project from existing source (as the tutorial says), when I browse to the “facebook-android-sdk” folder and create the project, I get this message in my cosole: [2011-12-04 14:01:49 - com_facebook_android] AndroidManifest.xml file missing! Also in the package explorer, the src folder seems to be empty.

  2. If I try to import the project when I browse the folder I get a message “No projects are found to import”

  3. I also tried to make a test project where I copied all the classes of the android facebook sdk so that I can use them. It worked up to a degree, but it does not seem a proper thing to do.

  1. 从现有源创建项目(如教程所述),当我浏览到“facebook-android-sdk”文件夹并创建项目时,我在我的 cosole 中收到此消息:[2011-12-04 14:01:49 - com_facebook_android] AndroidManifest.xml 文件丢失!同样在包资源管理器中,src 文件夹似乎是空的。

  2. 如果我在浏览文件夹时尝试导入项目,我会收到一条消息“找不到要导入的项目”

  3. 我还尝试制作一个测试项目,在其中复制了 android facebook sdk 的所有类,以便我可以使用它们。它在一定程度上起到了作用,但似乎不是一件合适的事情。

So what do I do wrong? Is there something else I should do using the git repository (I am completely new to git)? Or is there something wrong that I do when I try to import the project? I've searched the problem here and in other forums but didn't find a satisfying answer (or maybe I did not understand it). Please help!

那么我做错了什么?使用 git 存储库我还应该做些什么(我对 git 完全陌生)?或者我在尝试导入项目时做错了什么?我在这里和其他论坛上搜索过这个问题,但没有找到令人满意的答案(或者我可能不明白)。请帮忙!

EDIT: I've tried one 4th thing

编辑:我已经尝试了第四件事

4: I extracted the jar out of the project I created in 1 (even if it had an error). It is working in terms that I can compile the code of the facebook-android tutorial step 6.2 - https://developers.facebook.com/docs/mobile/android/build/#sample. So far it seems that everything goes ok. But I do not know if this is right or I should have problems in the future..

4:我从我在 1 中创建的项目中提取了 jar(即使它有错误)。它的工作原理是我可以编译 facebook-android 教程步骤 6.2 - https://developers.facebook.com/docs/mobile/android/build/#sample 的代码。到目前为止,似乎一切正常。但我不知道这是否正确,或者我将来会遇到问题..

回答by Julia Hexen

I had the same problem. But now I think I solved it, even if the solution is not satisfying.

Create the project from existing source as the facebook tutorial says. Then make a right click on the project and choose "Import", choose "General" -> "File System" and go to "Next". Now click on "Browse..." and choose the folder .../facebook-android-sdk/facebook. Repeat these steps with the src and the res folder (right click on these folders for "Import", choosing the src and res folder in .../facebook-android-sdk/facebook).

Now it works. I don't know why Eclipse doesn't import all these things automatically, in the past it worked fine...

我有同样的问题。但现在我想我已经解决了,即使解决方案并不令人满意。

正如 facebook 教程所说,从现有源创建项目。然后右键单击项目并选择“导入”,选择“常规”->“文件系统”并转到“下一步”。现在点击“浏览...”并选择文件夹.../facebook-android-sdk/facebook。对 src 和 res 文件夹重复这些步骤(右键单击这些文件夹以进行“导入”,在 .../facebook-android-sdk/facebook 中选择 src 和 res 文件夹)。

现在它起作用了。我不知道为什么 Eclipse 不会自动导入所有这些东西,过去它运行良好......

回答by Hunter Gemmer

Make sure when you select the “facebook-android-sdk” folder you add /facebookat the end. So type into existing source C:/Users/facebook-android-sdk/facebook and it should work.

确保当您选择“facebook-android-sdk”文件夹时,您在末尾添加了/facebook。所以输入现有的源 C:/Users/facebook-android-sdk/facebook ,它应该可以工作。

回答by Fitch

Make sure that your code's directory is dropped directly in Eclipse's root Workspace directory. There seems to be a bug in the latest version that only allows this kind of import/load when all code is directly in a directory in your Workspace. Otherwise it copies just a couple folders/files from where you put it, and not the rest, and gets quite confused.

确保您的代码目录直接放在 Eclipse 的根 Workspace 目录中。最新版本中似乎存在一个错误,仅当所有代码都直接位于您的工作区的目录中时才允许这种导入/加载。否则它只会从您放置的位置复制几个文件夹/文件,而不是其他文件夹/文件,并且会变得非常混乱。

回答by Arizanov

I downloaded the file in zip format from the git directory. I created a android project, then i imported the zip archive (import ->archive file). It worked for me.

我从 git 目录下载了 zip 格式的文件。我创建了一个 android 项目,然后我导入了 zip 存档(导入 -> 存档文件)。它对我有用。

回答by Ojonugwa Jude Ochalifu

If you want to import projects into Eclipse, you do not have to go down to the src folder, just do

如果你想将项目导入 Eclipse,你不必到 src 文件夹,只需执行

File > Import > Existing projects into Workspace

File > Import > Existing projects into Workspace

then go to the directory where the folder is, say your Documents folder C:\users\Documents then just click 'ok' The window then displays all the folders in the Documents folder. you can then select the project you want to import and click finish.

然后转到文件夹所在的目录,假设您的 Documents 文件夹 C:\users\Documents 然后单击“确定”该窗口将显示 Documents 文件夹中的所有文件夹。然后,您可以选择要导入的项目并单击完成。