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!
Related
i installed the following plugin to my cordova project to receive push-notifications (and followed the given steps):
github.com/phonegap/phonegap-plugin-push
I also installed all needed resources by the sdk manager (extras-> google play services, support repository+libraries etc.)
But unfortunately i get an error in eclipse:
The packages com.google.android.gms.gcm, com.google.android.gms.iid, android.support.v4.app are missing somehow.. (or cannot be resolved)
i don´t know what i´m doing wrong..
is there any step-by-step tutorial for implementing the push-plugin in a cordova 5 app?
or is there any solution to this?
thanks!!
Screenshots:
http://abload.de/img/unbenannt-11qbf4.jpg
and
http://abload.de/img/unbenannt-2i7ozz.jpg
May be it would help you.
It is asking to add v4 support.
Try this:
Right click on you project in eclipse
Then select "java build path"
Click on "libraries tab" then click on "Add external jar file"
now you will get this v4 jar file in C:\Users[username]\AppData\Local\Android\sdk\extras\android\support\v4
NOTE : if you cant find the AppData folder then make sure to change hidden
settings.
Recommended to start using IDE Andriod Studio for Phonegap to prevent further issues. Android SDK has changed to suit Andriod Studio. I have build a clean project and paste over the index.html in Andriod Studio. No errors at all and gradle will help build all the projects file with 1 click!
I am trying to import the latest version (4.0.1) of the Facebook Android SDK into eclipse but I am facing issues in having the project being properly built and imported as a Library.
I followed the steps (for android studio, ported to Eclipse) provided in the official guide and looked through Google for other developers having the same problems as I am having but I am still not able to have it properly working.
Here are the steps I do:
Download the Facebook SDK for android from here: https://developers.facebook.com/resources/facebook-android-sdk-current.zip
Extract the projects
In Eclipse, import existing Android code into workspace
Select the folder "facebook" and choose the only project that is shown (the project is properly imported)
Right click on "facebook" project, properties, android and check "isLibrary"
clean project
At this point I still have issues for annotations and classes not found from "android.support" package.
Project's setting for Java compiler is "1.6", minSDK is 9 and target is 17.
I tried also to add the facebook library to my main project but it is still not working.
I tried to put java 1.7 in the compiler but it is not resolving the missing classes plus it is saying that to compile with java 1.7 I need to have min API set to kitkat (which I don't want because I will not be able to compile for 4.2 and 4.3).
I added manually the androd support jar from the SDK Manager folder of android and this resolved partially the missing classes but some did remain.
I am using Eclipse Version: Luna Service Release 1 (4.4.1) with JDK 1.7.0_51 and the latest ADT Plugin (all android components updated with SDK Manager).
Any help is appreciated.
I did some more tests and find out that by downloading the two libraries:
android-support-v4.jar
bolts-android-1.1.2.jar
from the github project (https://github.com/facebook/facebook-android-sdk) did the trick.
So the steps are the following:
Download, unpack and import as android existing code into workspace the latest v.4 version of the Facebook SDK for Android.
Download the two jars from GitHub
Set the Facebook Project as "isLibrary"
Add the two jars as "external jars" in the classpath
Set the java compiler to 1.7
clean and rebuild the project
Now errors are gone.
Download the facebook sdk from here.
Extract the zip file.
Import only facebook sdk project into eclipse as "Existing Android code into
workspace".
Now, this project will show many errors, do not open any java file or
resource file and do not try to do any imports or clean project until I
mention it to do so.
First add the v7 library to this project by doing right click on facebook
sdk project >> properties>>android>>Add Library.(If you don't have latest
v7 support library download it from sdk manager), also set the project build
target to the maximum android version available and select "is library".
Now, right click on facebook project and select >Build path>Configure build
path>Libraries tab>Add external jars> browse to place where you extracted
facebook sdk in step 2 and find two jar files in libs folder(android-
support-v4.jar and bolts-android-1.1.2.jar) and add both files. Switch to
"order and export" tab and select both the jar files and click on ok.
Now right click on facebook sdk >>properties>>Java Complier>>set the
"compiler compliance level to 1.7 or more and use default compliance settings.
Now select the project and click on Project > Clean.
This should remove all errors now. This is how it worked for me.
Android Facebook SDK import occurs with errors - Eclipse
Check this out. May be this will help you.
I faced same problem while working in Android Studio.
But you are facing in Eclipse.
I imported the Facebook SDK as library project into eclipse. I did it by checking Copy projects into Workspace and by leaving it unchecked as well (for some reason the description says that I must uncheck it).
I tried importing Existing Projects into Workspace and Existing Android Code Into Workspace as well.
The library checkbox is checked in the properties.
A Facebook sdk has never been imported into this workspace yet.
I created a new project that runs smoothly without Facebook. In the properties, Android tab, I added the library project. It showed a green tick, but when I open that tab again, it shows a red x.
The target of the project is API level 19, the target of the facebook library is API level 8. I also tried it with API level 10
I am using Java compiler 1.6 in both the project and the library.
What I don't understand is that the sample projects that came with the SDK seem to have successfully imported the SDK (green tick), however they all point to the same problem "The import android.support cannot be resolved" on import android.support.v4.app.FragmentActivity; I had to hover over the line and click Fix Project setup to make them work. Then I went to Properties -> Java Build Path -> Order and Export -> clicked v4 support library checkbox. So at least they work. Why do they successfully load the Facebook SDK and why is my app unable to do it?
The Facebook SDK has no libs folder so I guess an interference between different v4 support libraries is out of the question.
I have tried this on two different computers as well.
I decided to install Android from step to step instead of the ADT Bundle. I downloaded Eclipse Juno for Java Developers, installed the newest Java version (1.8) and installed the Android packages. Created a new project and imported the facebook sdk 3.5 (tried 3.0.2 and 3.8 as well). I still get the red X.
I appreciate any help.
I ran into this issue half a year later and my earlier answer was of no help. The trick is that you need to have the library on the same drive as your project, which is usually the C: drive. That's all. Thank you Facebook for not notifying us about this..
Solved. Here is what I did to solve this strange error.
Copy the contents of project.properties file.
Delete project.properties file.
Create a new file and name it project.properties
Paste the contents of the previous file into this new file.
I am just starting to learn Libgdx, and am in the process of importing the 4 projects[desktop, main java game, android, html] into Eclipse Juno. I have not added any lines of code, just trying to get them to run on the different platforms.
It runs fine on the desktop version, but when I tried to run it in the Android emulator I get the error. Cannot find mygdxgame.apk!
I realized that my gen folder is completely empty, there is no R.java for the project. I have tried a number of things to make this work, but none of it is working. I am listing the things I have tried so far, and the hopefully the reason why I am asking this repeatedly asked question.
Project > Clean
Package Explorer [right click on my project] > Android Tools > Fix Project Issues
Deleted gen folder and Project > Clean
Restarted Eclipse
Deleted the project and Imported it again
Set Compiler Compliance Level to 1.6 for both main java game and Android project
Added a dummy XML to the android project and tried clean, and deleted it
Unchecked and rechecked Build Automatically
Checked my target-sdk in project.properties and made sure it is the same Project Properties -> Android and in my Manifest.xml
[Right click on project] > Properties > Java Build Path > Source tab, Removed mygdxgame/gen folder and then added it again
Made sure Project Properties > Android > Is Library is unchecked
Nothing has worked so far. My gen folder is still empty and I am unable to run the Android project because of the same error. Cannot find mygdxgame.apk!
What else can I do to fix this? In case this is answered I would appreciate someone giving me a link to the solution, as I have been pouring through SO and Google in general for nearly 2 hours now, with no success.
Regs
What happened to me a few days ago:
1.- I got the SDK Tools 22 update and I installed it, no other update appeared in my sdk manager... so I closed it.
2.- Then I got that "NO APK" error and tried every answer I could find.
3.- I opened SDK manager again, and I noted SDK Platform Tools also got an update and there was a new one: SDK Build Tools. Both of them didn't show up when I first updated the SDK Tools.. so.
ANSWER:
Open SDK Manager and check if your SDK Tools, SDK Platform Tools, SDK Build Tools are updated :)
On your build path, you should have a reference to the main project, under Projects tab of Java Build Path. Under Libraries, you should have gdx-backend-android.jar and gdx.jar along with Android not being a library.
Please check if Android is set as a library. If so, uncheck it. To do that, right click on the project and then select Properties. Choose Android on the left panel of the new window. Uncheck Is Library if checked.
Here's something might help-
Unable to run Android app, Could not find .apk issue in eclipse
I would take alook at your buildpath if all libs are correct. If it's a projekt from an other computer the libs are often at different places so you need to correct those manual. If they are not correct the android projekt do not generate your R. class and so on. So do rightclick on the core projekt -> Buidl Path -> Configure Build Path. Now take a look at the libs if all are there. I had the same issue with the android 15 apk so i need to add it manual. The clean or such do not fix such because eclipse can't know where you have all your libs.
If you really dont get it run i would recoment to use the setup ui of libgdx. It does noramlly handle all imports and so on for you. You can also use it to update your current projekt and so on.
Else i would read the guide for Manual Project Setup of Libgdx.
Libgdx setup Guide
I hope this does fix it.
I was working on an android tutorial and it wanted me to import the library from another project .The import worked and the project works correctly. But I noticed that doing that messed up several of my other projects (the ones that use Android 2.1) by apparently messing with the build path. Now instead of seeing "Google APIs [Android 2.1]" under the gen folder I see "Unable to get system library for project".
I verified the following:
I right-clicked the project and went to Properties I see that the correct Project Build Target is checked(Google APIs [Android 2.1]), but "Unable to get system library for project" is still shown above the assets folder and below gen and Android Dependencies. Cleaning all projects doesn't help.
How can I fix this problem?
is there a way to fix this issue globally or do I have to do it one by one?
I had the same problem. Try
Right click on your project
Go to properties
Click the Android section
Select a different target api (assuming one is already selected, as mine was - otherwise, select the one you want and jump to step 9)
Click OK
Do steps 1-3 again
Select your original target api
Click OK
Clean and build your project
Worked for me, anyway.
Derived the solution from:
"Unable to get system library for project" after I upgraded to Android SDK 2.3 and ADT 8.0
Error in .classpath on your project. It not connect to android sdk. Fix it and clean project. :-)
This happens when you are targetting an API version that for some reason is not mapped on your buildpath.
See which is the version of the SDK you are pointing to at the project.properties file.
Go to the SDK Manager at Window->Android SDK Manager
Check the Android API item that matches the version you want to use, OR, click on the latest one and then update your project.properties file.
Make sure your project build configuration is Project->"Build Automatically"
Retsart Eclipse (claning and rebuilding may not refresh all the project properties)
Borrowing from #Erhannis answer :
"
Right click on your project
Go to properties
Click the Android section
"
When I view the build target everything looked fine :
So I checked another build target , hit apply, and then re checked my original build target (Android 4.4.2) and re-hit apply. My project then compiled.
For me the project.properties file was missing (it was code from a repo I checked out). So I just created one with this line:
target=android-20
After that, Erhannis' solution worked for me.
Just for completing Erhannis answer: If you fixed the problem but it appears again when you restart Eclipse, then just go to the file local.properties on your workspace folder and verify that the location of the Android SDK there is correct.
At times, when only single Android SDK version is installed on your system, and if it gets changed either by un-installing / re-installing Eclipse, or otherwise (directly through SDK Manager), then this issue might crop up.
.
This is accompanied by the message like this on Eclipse console:
YourApp] Unable to resolve target 'android-22'
.
A simple workaround to this issue is:
Open AndroidManifests.xml of the project, and in the:
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
change the targetSdkVersion to the one currently installed on your system
Next, open the project.properties file and update
target=android-21
to your current SDK version
Finally, clean and re-build the project
Right Click on Project-> Select Android tools -> Select Fix Project Properties
This did the trick for me.
You need to click on the menu icon with the Android sitting in the grey box with a white arrow pointing down "Opens the Android SDK Manager".
or, from the command line, run:
%ANDROID_HOME%\tools\android sdk