I'm trying to reference the Facebook SDK to my existing Android project. I've been going through the given tutorial in the Facebook site. So here's what I've done:
I copied the Facebook SDK folder to my workspace.
Went to Project->Properties->Android
Set the "Is Library" radio button to true and pressed on the "ADD" button.
But I don't see in the popping dialog anything, it's just blank, no SDK.
What am I missing here?
Here's the workspace folder, and the Facebook SDK folder is located in it:
And here's the Android Properties. As you can see there's no Facebook SDK there. It's just blank:
So here's what you've done:
Copied the Facebook SDK folder to my workspace.
Went to Project -> Properties -> Android
Set the "Is Library" radio button to true and pressed on the "ADD" button.
Well, you are not supposed to do the Steps 2 and 3. The Facebook SDK is already coded to be a library project and you just need a reference to it in your existing application. Hence, the ADD button should be pressed in the existing project and it should reference the Facebook SDK.
Here is what you need to do :
Go the website and get the contents by using git or just zip everything using the ZIP button
Put the Facebook SDK folder in your workspace (no need to select it "Is Library" )
Select your Existing Android Project
Right Click -> Properties -> Android
In the Library section, click on Add (by doing this step you are adding a reference to the Facebook SDK in your existing application)
Select Facebook SDK there
You are good to go!
Related
How to import facebook sdk 4.8.2 in eclipse. I am unable to import as facebook folder contains aar file when we directly download developer site. And from git , unable to get src files of facebook
Here you have an answer from Android Facebook SDK 4 in Eclipse
I also have faced this problem, so I will write a short guide, how to
install it in Eclipse.
Step 1. Import to Eclipse First of all, download the latest
version of SDK (on current moment it is 4.0). Unzip it to a
folder.
Open Eclipse, click the right mouse button in "PackageExplorer" and
choose "Import". After that, go to "Android" -> "Existing Android
Code Into Workspace".
Now click "Browse" and choose unzipped SDK folder, and deselect all
other found projects, except from the "facebook" (it is an SDK).
Other included projects are just samples, and you don't need them now.
You may select "copy project to workspace" checkbox, if you need this.
Step 2. Fixing errors After importing, we will see, that the
whole facebook SDK package are in errors:
But if we look closer, and open one of marked as error classes, we
will find, that SDK tried to importsupport.v4 library:
It required for properly compilation. You can find instructions how to
download it using Android SDK Managerhere.
After it downloading, you can find it in your Android sdk folder:
<sdk>/extras/android/support/v4. Then add it to the facebook SDK
project: right mouse click on SDK project -> "Properties" -> "Java
Build Path" -> "Libraries" -> "Add External JARs", and choose
android-support-v4.jar from it's folder.
After that a lot of errors will be gone:
But, there are other errors. So we are going to another class, and
found it error code piece. Move mouse pointer on it, and Eclipse will
show you the hint, of what kind of error you are facing. It says that
your compliance Java must be version 1.7. Allow Eclipse do it by
clicking "Change project ...", or do it manually by going to
"Properties" -> "Java Complier" -> "Compiler compilance level"
-> "1.7".
OR
Moving ahead. Now we are facing only one kind of error, that says that
the FB SDK can't find required Bolts Android library.
We are going to google, found it compiled jar in a repository.
Choose the latest version (for current moment it's 1.2.0, but SDK
gradle file is using 1.1.4, so you may choose that), and download the
jar. Now add it to the facebook SDK as external lib, as we do it
before.
Voila! Ther are no errors anymore!
Also don't forget to set in the facebook SDK project "Properties" ->
"Android", that it is a Library.
Just for ensurance, close/re-open the SDK project and clean it
("Eclipse menu" -> "Project" -> "Clean"), so all files can build
properly.
Step 3. Add it to the Android project Now you can try to add
it to your Android app. Go to your Android app project "Properties"
-> "Android" -> "Library" -> "Add", and choose facebook SDK.
Follow official tutorial, and set up your Android application
project (don't forget to add all required elements to Manifest.xml).
Than you can use this tutorial to add LoginButton to your
Activity. Try to build it. It should run without problem.
This also might be helpful, if you find any issue: Facebook SDK v.4 for Android: errors on Eclipse
Check also: Android Facebook SDK configuration on Eclipse
Hope it help
EDIT: As you would see in the comments below, this answer is not already corrected. The best way to deal with this problem is export project from Eclipse to Android Studio, which doesn't have this issue and becoming the first Android Developer tool, where Eclipse seems to be as was said on Android Dev Summit 2015 truly deprecated.
Thank you so much! I'm still procrastinating migrating from Eclipse to Android Studio. And I found that the last version that works with Eclipse would be Facebook Android SDK 4.5.1. Download link here: https://origincache.facebook.com/developers/resources/?id=facebook-android-sdk-4.5.1.zip
Following this instructions make it work!
I know there are lots of questions and articles about how to integrate android facebook sdk into an existing project. I have tried some of the methods they have but with no success.
I have imported the facebook (sdk folder) into a new project and have the resulting src, res folders in a separate project. I am still not sure how to integrate that with my already existing project.
I know I cannot simply copy and paste the java files into my project because there will be errors linking resources and other .java files as the package names and destinations will change.
What is the simplest way to do this?
Thanks.
Import the FB SDK to your workspace. Then open the properties dialog of your project.
Click the add button at the bottom of the dialog. Choose the FB SDK you have imported. Click Apply and Ok.
Look that (Spanish blog, you can translate)
http://fpalero.tk/facebook-sdk-para-android/
If you dont understand say me and i translate for you and explain all steps.
But it's easy, when you import sdk facebook only delete libs/“android-support-v4.jar” on your project and changes by the libs folder of sdk facebook.
see the facebook developers site for complete detail and for download Facebook SDK for any platform
facebook sdk download and integration sdk to project and also interaction to messenger with intent
Right click on your project in project explorer window >> Properties >> Andoird >> In the dialog poped >> click on Add >> Select the FB library >> Click ok
Facebook sdk will be added to your project.
Possible duplicate, I just download a Android Studio Zip file like Eclipse, as I opened getting this error.
But problem is how to update it?
same problem happened to me, From this
I have faced the same issue, to solve it:
1- delete (or move) the projects folder (AndroidStudioProjects).
2- Run the Android-Studio (a WELCOME screen will started).
3- From Welcome Screen choose, "Configure -> Project Defaults -> Project Structure)
4- Under Platform Settings choose SDKs.
5- Select Android SDK -> right_click delete.
6- Right_click -> New Sdk -> Android SDK -> choose your SDK dir -> then OK.
7- Choose the Build target -> apply -> OK. enjoy
I had same issue in Android Studio 3. (the project was open) so I closed the current project and the IDE automatically prompted to download the latest components. once its done everything was working correctly.
Here's a better approach where you don't have to delete/move anything for Android Studio 3.+.
Open Android Studio and click cancel/ignore for error prompts on missing SDK for each project.
Close all your open projects. You can do this by File > Close Project.
After you do step 1 for all projects, the Welcome screen appears.
The welcome screen will detect you are missing the SDK and give you options to fix the problem, i.e., install the SDKs for you.
Click on Tools > SDK Manager or click SDK Manager
after If you are unable to see the location of your Android SDK Location, click on edit and create a folder where you want to keep it and then click Next and Finish
Source: https://stackoverflow.com/a/46351772/13093413
(Top right corner) File > Close Project > After you close the project you will get a screen which says that you don't have an sdk and will ask you if you want to install it.
I was able to trigger an SDK download like this:
Close Android Studio
Open android studio, but be ready
Once you see "loading project", click cancel. (this will only appear for seconds on a fast machine)
The SDK download window appeared!
If Android Studio directly opening your project instead of setup window, then just close the windows of all projects. Now you will able to see the startup window. If SDK is missing then it will provide option to download SDK and other required tools.
It works for me.
Create SDK folder at \Android\Sdk
Close any project which is already open in Android studio
Android Studio setup wizard will appear and perform the needed installation.
Press escape to close all errors.
close project
Android studio will prompt to install SDK
Install the SDK and configure project
1.Click on Configure
2.Then Choose Project Defaults
3.Click on Project Structure
4.Set android sdk path
You will find here "C:\User\YourPcname\AppData\Local\SDK"
Note: Sometime AppData may hidden if it will not show then enable show hidden content.
5.Apply Changes
6.Then Select Sdk From Configure option
7.Then Android sdk manager page is open
8.In bottom you will see Install packages option
9.Install them and enjoy.
im just trying to intall facebook sdk to my phonegap android project.i followed
https://github.com/phonegap/phonegap-facebook-plugin
and after intalling fbsdk I have added it under Project
properties->Android->Library
section and select the facebooksdk library Im seeing green color tick mark infront of the added library. but when i opened Project again
properties->Android window
the green tick mark is not displaying under Library section,
instead I'm seeing red cross mark..i have added external jar files also but
cant find out the solutoin.is there any solutions for this ?
Following are the steps to include Facebook SDK into android project:
1) Download the Facebook SDK from the https://github.com/facebook/facebook-android-sdk/ and extract it to local drive.
2) Import "facebook" as a android project into your Eclipse, this is your Facebook SDK, and You have to reference it to your android project.
3) Now create your android project.
4) Right click on it, go to Properties-->android and Add the "facebook "Library as a reference to your project. click Apply.
Check the video link: http://www.youtube.com/watch?v=w-vNi1W4fco
I downloaded the android's facebook sdk but so far I couldn't configure properly. Eclipse doesn't recognize the facebook sdk as a project.
Does anyone got this problem?
You should use the git plugin to import the facebook project from github into your eclipse workspace. It's configured as an android library. And then in your android project in which you want to use the library. Right click on the project and choose properties. Click on the Android tab, and at the bottom should be a section for libraries, detailed instructions here. Click Add, and the facebook sdk should appear. Check the facebook sdk and it will then be available in your app.
Facebook SDK integration into an android application should be easy, but there are some caveats to take care of during the first integration steps, so follow it carefully:
Download the SDK from git hub - This could be done using a github client, but an easier way is to simply download the zipped version by pressing the "zip" button as appears in the following snapshot.
Extract the zip file - make sure to extract it into a folder that is not within the eclipse workspace. In the next step you will need to create a project in eclipse based on this zip, but sometimes, putting the extracted zip directly into the workspace confuses eclipse, so avoid putting it there. Put it somewhere else.
Open Eclipse and create a new Android Project (File -> New -> Project -> Android Project) for the Facebook Android SDK source. (On the next step you will add it as a reference library to your app). Create the project by selecting "Create project from existing source" and specify the facebook-sdk folder into which you extracted the zip.
(note: if you want it to be stored in the workspace itself, you can always "import" the project into the workspace later on)
Add it as a project library to your app by selection the current project (of your app) -> properties, and add the facebook project as a library to your current project.
later steps include adding permissions to the Android Manifest such as
uses-permission android:name="android.permission.INTERNET"/>
and then adding your application ID into the code. I will skip the details here as it is quite straight forward.
following steps are for creating facbook-android.jar (use this jar file in your any project)
Step1: Download Facebook Android SDK from github.
Step2: Extract it. (at any location).
Step3: In Eclipse create new project using create project from existing source option
Step4: Enter the project name as "com_facebook_android".
Step5: Set Location to "facebook" folder in extracted location.
Step6: Click Finish.
Step7: Select the "com_facebook_android" project in project explorer and right click select export option.
Step8: In the export wizard select JAR file in Java folder.
Step9: Click next then browse the location for jar file and give the name as yor wish like "facebook-android.jar"
Step10: Click finish........ JAR file will be created in that location
This is not correct process, you should use facebook-android project as library project, because resource files will not import to your project while you are using .jar file
jar file is only for Java Projects not for Android Project, Some of jar files may work but not all..