Could not find Facebook SDK.apk - android

Hey I know this was asked before, but none of the solutions seem to help.
This is NOT a duplicate
I have used the Facebook SDK before on an earlier project,
now I started a new one and I get this weird error.
I have set a reference to the library
I have set the Facebook SDK project as a library
I have tried deleting it and re-adding it according to the official documentation, and basically tried everything in this question.
Though I still get this error and can't find out why.
Worth to mention, when I tried to use the facebook class, it gave me an error with an option of "fix project", which I did and still didn't work, might be related?

This is common error. Just remove FacebookSDK project from Properties->Java Build Path->Projects . This project should be referenced from Properties->Android
For more information, see this answer: Could not find Library.apk!

Well, after alot of searches the only thing that worked for me is just creating a new project and copying all the files to it.
I tried avoiding it but that seems like the only thing that works =/
As there is no answer on this topic whatsoever, so if someone could find out a better solution - it will be very helpfull to the community

Hmm.. I just want to ask whether did you import the Facebook SDK into Eclipse itself? Because I had did a project using Facebook and the thing is that besides referencing, the guide I followed actually instructed that the SDK must be imported into the Eclipse.
You might probably want to have a look at this. Else, the other way is just like what you did, copying all the files.

Try deleting the Facebook application for Android (if you have one installed on your phone). This worked for me.

i dont know how this is happened but it works :
first : i have added all facebook3.0 related sample + facebookSDk projects in one workspace .
second : i have run a sample project . in which i found a .jar file :
androiddependencies->facebooksdk.jar (note this exact path )
third :
1.) i created my project .
2.) inside this i have removed errors by :- FixProjectSetup (atLast position )
3.) i have added facebooksdk.jar by right_clicking at project->properties->android->by checking android 4.2 + reference the Facebooksdk -> done .
now i am able to create and run programs easily .

Related

Adding google maps library to existing project creates confusing error

I am building an Android app that I want to open google maps with the click of a button. I want the app to find the current location of the user and give them directions to a predefined address. I started building the application before I realized there were special steps that you have to take to include this functionality. To add this feature to my project I followed the directions on these two sites:
https://developer.android.com/google/play-services/setup.html
https://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
The problem is on the second site, when i added the library to my already existing project it caused all of my code that has findViewById(R.id.whatever) or setContentView(R.layout.whatever) to become errors. It is now telling me that i need to import the class R. If I do that it then gives me error messages on the names of all my xml files.
For example in my MainActivity it is telling me that i should change setContentView(R.layout.activity_main) to setContentView(R.layout.activity_list_item) and does this for all references to my xml files for the entire project.
I tried going back and removing the google play services library from the project and starting over but when I removed it the errors still persists. I also tried using the "fix project setup" option in Eclipse but it didn't fix the problem.
I'm wondering if anyone here has experienced this problem before? If so, how can I fix it? The application had no errors before I tried to include the google play services library. I am new to Android development so a lot of the information I have found has been either confusing to understand or doesn't seem to include enough details for me to figure it out. Thanks for your help!
Look at your imports, and check if you are importing the correct R.java from your application package, not from the android package.
Check also if your XMLs don't contain errors, otherwise R.java won't be generated.
In my case android-maps-library had to errors in two files (I have forgotten their names), I edited the two files removing errors my self. And finally I was able to used it quite nice.
i think you have correct yout Project build target, and this how:
right click on your project folder in the package explorer->propreties->Android
then porject build target and choose you Android target (Android x.xx)
but before that you need to remove import android.R;

Eclipse error : Your project contains error(s) , please them before running your application in android

When i run my project , I get " Your project contains error(s) , please them before running your application" this error . I searched this error on Google , There i got a lot of solutions all these did not work for me . I cleaned and Build my project , Restart my eclipse , in .android deleted debug.keystore and clean and build my project , But did not work for me . Please help me .
Thanks in Advance
Follow My steps :
There are many possiblity of this type of error try by one of the following .
Step 1 Right Click on your app then check library and order and export tab there may
be any error remove that according to your project .
Step 2 Right Click on your app then go to java compiler and made change of
compiler level
Step 3 If you have added any library project check that also
It works for me hope it will work for you also .
In my case, all the solutions you generally come across in the Net turned out inappropriate.
What I have recently found is that if you wanted to import a given Android project,
and you used General/Existing Projects into Workspace or Archive File,
you may probably face the issue above when there is no problem in the source itself.
What I did was using [Existing Android Code Into Workspace] instead of the above.
With this authentic way of importing Android project, such an error did not come about.
//
Of course, this applies when you properly added some necessary libraries and you have
no issue with your source codes.

Android Facebook-SDK

Hello I am trying to learn a little bit of facebook-sdk for android but no luck.
I will post some screenshots so you easy understand what is my problem.
1st step I am adding the SDk to my project
2nd step I import Classes but i get an error
And when I am going back to android tab I see this
Really need help. I tried Many times to follow the steps from FB Guide in case I forgot something but didnt helped... Thank you in Advanced.(I am new to this hope you will understand)
Your "Jar mismatch" problem comes into picture because of the Facebook SDK itself has android support v4 jar as well as your project also same jar file.
To solve this problem..
Go to your project's properties -> Java Build Path -> Order and Export :
Now remove the Tick-Mark from Android Private Libraries.
make sure that you had already used facebook SDK's private library (tick-marked)
And then after clean your work space..
It will always help me..
Hope this will help you to solve your problem.

java.lang.NoClassDefFoundError with external jars in Android project

I've been searching the internet for two days now, and I feel like I've tried everything.
Please let me know if any code snippets might be helpful in finding a solution.
I've created an android application with the standard login activity. In the doInBackground()-method, I invoke a static method from another external class. Since this method will be invoked once the submit button is clicked, the error occurs during runtime. The class is included in my file, and there are no compilation errors. Whenever I tap/click on the Submit-button, I get a java.lang.NoClassDefFoundError referring to a class (in my external jar) that is used and properly included in my external file I refer to in the doInBackground()-method.
All my external libraries are in the 'libs'-folder. I've tried adding them to the build path manually instead and checking the boxes next to them in the 'order and export'-tab instead of the checkbox next to the 'Android Private Libraries' entry. I've tried putting the 'gen'-directory above the 'src'-directory, which didn't change anything either. Restarting eclipse, reimporting the project as a whole, playing around with the order of the external libraries in the build path, fixing project properties and cleaning the project over and over, nothing helped. I've checked this
http://javarevisited.blogspot.de/2011/06/noclassdeffounderror-exception-in.html
and tried every solution, but none of them worked for me. I ad a similar problem with a library before, and I could solve it by changing some build path settings and restarting Eclipse. However, this just doesn't work for me any more. I hope anybody has another solution or an idea, I have no clue what's wrong...
Thank you all in advance!
Yeehaw
Edit:
Despite creating a whole new project and adding my previous files to this new project, I still had the same problem in the new project. I think I figured out where this error came from: When I added my external library, I still had dependencies from the just added .jar to other jars. After adding those as well, the compiler said I needed the java.rmi.Remote class, which is in Java's JRE system library (rt.jar). Adding the whole jre library to my project made the compiler error disappear, the runtime error, however, still persisted.
After some more research I found out that my external library is probably not compatible with the android runtime environment, which means that the jar's .class-files don't have an equivalent .dex-representation which is neededfor the Dalvik virtualmachine on android powered devices. For many java jar's, especially those designed for use with the android platform, those problems don't occur.
Please correct me if I'm wrong, but this explanation seemed pretty plausible to me. Too bad, since this is the only way to currently access our database programmatically.
Make sure you've updated to the latest version of ADT Eclipse plugin and SDK Tools and also make sure "Android Dependencies" is checked in your project properties.

Project 'HelloFacebookSample' is missing required Java project 'facebook'

I have been following the instructions for integrating the facebook SDK into my apps. I have succeeded in getting all the given sample apps to compile and run except for "helloFacebookSample". For this I get a compilation error:
Project 'HelloFacebookSample' is missing required Java project 'facebook'
My understanding of projects/libraries/build paths etc is a little hazy, but I can not work out why this should fail where all the others succeeded.
Here's a screen grab of my properties window for HelloFacebookSample:
I can confirm that the directory:
c:\android stuff\facebook\facebook-android-sdk-3.0\facebook\bin
contains a file facebooksdk.jar
Any ideas?
EDIT: Thrashing around some more, I just clicked on the "projects" tab that you see in the screen grab above, and saw that it says "facebook (missing)". I'm a bit confused because I thought that projects may need to rely on libraries rather than other projects... but still I have no idea how to resolve the problem. I don't seem to have a project called simply "facebook"...
Edit: thrashing around some more, I just experimentally deleted the "facebook (missing)" from the java build path and then did an "add" of "FacebookSDK"... I thought this was cluttching at straws, but to my surprise it worked!!! HelloFacebookSample compiled and ran!!! - I have no idea what's going on though and would still like an explanation.
The previous version of the Android Facebook SDK referred to the project as 'facebook'. It looks like this sample was not updated to delete the old reference, and add the new one to 'FacebookSDK'. You took the corrective steps to resolve this yourself already by modifying the Java Build Path of the project.
The problem will easily be removed by simply going to the properties of your project and right clicking it, then go to project tab, select the project which prompts missing and remove it.
Now click on project->build project->clean
Now run your project and it will surely do fine

Categories

Resources