Android Facebook SDK 4 in Eclipse –

Development issue/problem:

Is it possible to import the new Facebook SDK for Android into Eclipse without Gradle or Maven (a bit like the previous method)? I’ve searched several sites, but I couldn’t find my way around.

Thank you very much.

How can I solve this problem?

Solution 1:

I also came across this problem, so I’m writing a short tutorial on how to install it in Eclipse.

Step 1. Input into Eclipse

First download the latest SDK (currently 4.0). Unzip it into a folder.

Open Eclipse, right-click in PackageExplorer and select Import. Then go to Android -> Existing Android code in the workspace.

Now click Browse and select the unzipped SDK folder, and uncheck all other found projects except facebook (which is SDK). The other projects included are just examples and you don’t need them right away.

You can choose whether or not to copy the project to the workspace.

Step 2. Error correction

After importing, we find that the entire Facebook SDK contains errors:

But if we look closely and open one of the errors marked as class, we see that the SDK has tried to import the importupport.v4 library:

This is necessary for a correct compilation. Instructions for downloading with the Android SDK manager are available here.

After downloading you will find it in the sdk-folder of your android: /extras/android/support/v4. Then add it to the android SDK project: Right click on the SDK project -> Properties -> Java Build Path -> Libraries -> Add external JARs and select android support -v4.jar in the folder.



After that, a lot of mistakes will disappear:

But there are other mistakes. So we go to another class and there’s a fragment of the error code. Move your mouse over it and Eclipse will show you an indication of the error that occurs. It indicates that your Java compliance must be version 1.7. Let Eclipse do this by clicking the Edit Project button… button or do it manually by going to Properties -> Java Compiler -> Compiler Level -> 1.7.

OR

Let’s move on. For the time being, only one type of error occurs, namely that the FB SDK does not find the correct Bolts Android library.

We go on Google and look up the pot in the repository. Choose the latest version (currently it is 1.2.0, but the SDK rating file uses 1.1.4, so you can choose that), and download the pot.
Now add it to the Facebook SDK as an external library, like we did before.

Voilà! You’re not wrong anymore!

Also don’t forget to mention that it is a library in the SDK properties of the Facebook -> Android project.

For Ensemble only, close/open the SDK project and clean it (Eclipse menu -> Project -> Clean) so that all files can be built up correctly.

Step 3. Add to Android project

You can now try adding it to your Android application. Go to the project properties of your Android application -> Android -> Library -> Add and select the Facebook SDK.

Follow the official tutorial and customize your Android application project (don’t forget to add all the necessary elements in the Manifest.xml). You can then use this manual to add a login button to your activity. Try to build it. It should work well.

Solution 2:

You can also use the following code, which works for me if you use the SDK 4.7 link from Facebook

Solution 3:

Yes, you can download the SDK from this
Home page, then select your Facebook application is already prepared, and you click Download Facebook SDK for Android, grab the package and note the location of the

Enjoy the folder.

Solution 4:

Both of the above answers/remarks are incorrect.
The latest Facebook SDK, 4.0, is for Android Studio and gradle.

In particular, there are no external bookshops in the loaded project. They are configured as compiler dependencies in the build.gradle file.

Dependencies {
compiles com.android.support:support:v4:[21,22]
compiles com.parse.bolts:bolts-android:1.1.4.

}

You need to create a libs folder in the Facebook project folder and add the v4 and bolt-android support banks to it, and then add the banks to the build path.

I’ve also had a problem with JDK compliance. By default my projects were in JDK 1.6, but the Facebook library requires JDK 1.7. The solution was to change the settings of the Facebook project under Java -> Compile settings.

Good luck!

Related Tags:

facebook sdk for android app,facebook-android-sdk latest version,facebook-android sdk github,facebook integration in android studio step by step,how to generate release key hash for facebook in android studio,how to generate key hash for facebook in android in mac,facebook pixel sdk for android,invalid key hash facebook android,how to get key hash for facebook android programmatically,facebook messenger api android