Unable to load Facebook SDK to Eclipse. Build Path Error - android

So I have not been able to even start coding for the app I want to build, I am having a really hard time getting the SDK set up for me to code based on it.
Here is what I did:
Downloaded Eclipse
Downloaded the JDK, Android SDK, and ADT on Eclipse.
Created a directory named "Facebook", where I cloned: https: //github.com/facebook/facebook-android-sdk .git (Separated to avoid the spam mechanisim :P)
Created a new project from existing source; please note that on the tutorials it reads "Create project from existing source" as an option within the "New Android Project" workflow, but my Eclipse only has "Android Project From Existing Code" (see: http://db.tt/gOmutx08 and that is what I used) as a separate workflow. Also, there is no "New Android Project" here, only a new "Android Application Project" and this does not prompt me to select an existing project as source (see: http://db.tt/usuzcTxS ). Not sure if this is where the problem is coming from.
Created a new project, and added the SDK project we created previously as a reference library.
The problem must definitely be on step number 4 as I get the following errors on my Eclipse Problems logger:
a) Description Resource Path Location Type
The container 'Android Dependencies' references non existing library 'F:\Users\Desktop_1\Android\Facebook SDK\facebook-android-sdk\facebook\bin\facebook.jar' Test-Facebook Build path Build Path Problem
b) Description Resource Path Location Type
The method onClick(View) of type new View.OnClickListener(){} must override a superclass method FbDialog.java /facebook/src/com/facebook/android line 101 Java Problem
c) Description Resource Path Location Type
The method onServiceConnected(ComponentName, IBinder) of type Facebook.TokenRefreshServiceConnection must override a superclass method Facebook.java /facebook/src/com/facebook/android line 575 Java Problem
d) Description Resource Path Location Type
The method onServiceDisconnected(ComponentName) of type Facebook.TokenRefreshServiceConnection must override a superclass method Facebook.java /facebook/src/com/facebook/android line 581 Java Problem
e) Description Resource Path Location Type
The project cannot be built until build path errors are resolved Test-Facebook Unknown Java Problem
Where the main problems are a and e, as the project cannot be built if there is an issue with the build path. Problems b through d can easily be fixed by removing the "#override" annotation from all three lines; however, I am not sure this is the actual fix because the SDK should have no issues in the first place, and removing the annotation may not make it work in the end.
Any ideas as to what I could try? I have already deleted the whole SDK download, and recloned the repository several times, even on different folders. Not sure anymore, and I am not sure why the screenshot from the tutorial looks way different than my eclipse. My guess is that the tutorial is slightly outdated as it still uses Froyo as a target :P
Any help is appreciated.

I had faced most issues you faced. I had it resolved.
Eclipse for some reason chose to keep facebook project is Java 1.5 eventhough my eclipse preferences had the setting to use Java compiler 1.6.
So, go to Project Properties in facebook project and select the java compiler to be 1.6. This solved my problem. Hope it solves yours too.

I've repeated Your steps and found out the following:
Seems Yours facebook project is not library one. Please, ensure that under facebook project Android properties 'Is Library' is checked (this should remove a and e errors);

Create project from existing source == Android Project From Existing Code
I think you have downloaded newer version of Android SDK - API Level 16 - Jelly Bean..
Before API level 16 , we had an option for Create project fron existing source , now it has been changed.
So if you wanna use Project from particular location you can use Android Project From Existing Code..
Also after creating Project make facebook source as library project...

Related

Configure build path suggestion when trying to extend ActionBarActivity

I’m trying to extend my class from ActionBarActivity and cant, already tried every possible way I know. I’m importing android.support.v7.app.ActionBarActivity; I want to add the lib without the resource as instructed on the android developer’s site. And every time I get the same error....I upload some photos
this is the error: Description Resource Path Location Type
The project was not built since its build path is incomplete. Cannot find the class file for android.support.v4.app.ActionBarDrawerToggle$DelegateProvider. Fix the build path then try building this project xxx Unknown Java Problem
a busy cat http://img29.imageshack.us/img29/1032/qlei.jpg
a busy cat http://img43.imageshack.us/img43/6339/n4cj.jpg
thanks
The problem has been fixed for me after adding android support library.
Right Click -> Android Tools -> Add Support Library
Check that you have the android-support v7-appcompat project in the Projects tab on Java Build Path as in the picture:
(I can't add the picture to you, but you find it by right clicking your project and choose Build Path --> Configure Build Path)
Check also that that project does not report any error.
I am a novice but I just passed by the same obstacle a couple of minutes ago.
I hope this help.
I copied the whole project and it started working.....strange

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

Using Android library in eclipse and jumping to class files instead of source file that is within eclipse workspace

I found this bug http://code.google.com/p/android/issues/detail?id=20731 that is resolved but it did not fix this exactly, but I see in comments that this is mentioned there as problem. Is there some way in eclipse to setup dependencies in project somehow , that I will be able to normally jump to source when I am in eclipse editor ? I tried numerous ways to solve this.
My setup is:
Android project that has Android Library setup in Android>Library
Android Library project that is within workspace and have dependency on Java library project
Java Library project that is within workspace and is opened as class file instead of source !!!
Including java library project through build path normally (this is causing build to fail)
[2012-03-13 11:07:21 - Taxicar Driver Android] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lrensoft/java/collections/GenericIterator;
[2012-03-13 11:07:21 - Taxicar Driver Android] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2012-03-13 11:07:21 - Taxicar Driver Android] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
Not including , project runs ok , but editor is jumping to library class files.
Note that I have to include Android Library project through build path , even though it runs ok without it (it is enough to set is as dependent android library) , but when I remove it I get also those files as class files :) .
So I think that right way is not including projects through build path at all but how then setup project to jump to source ?
I had a similar problem - Open Declaration command would bring up the .class file instead of the .java file. My problem however was occurring when I would use Open Declaration in my Android app project to goto some source in my Android Library project. By following some instructions from a comment on this blog post Eclipse now takes me to the .java file (instead of the .class file) when I use the Open Declaration command.
The instructions are:
Right click on your project, select Properties
Select Java Build Path page
Select Order and Export tab
Select each library project your project depends on, and use Top or Up to move it above the projects outputs. Eg. move all library projects to the top.
That fixed the goto .java instead of .class file issue for me.
(Unfortunately though, after making these changes, this issue appears (at least it did for me): Could not find Library.apk!)
I then setup my workspace as you describe in your question (Android App depends on Android Library project depends on Java Library project) I find that Open Declaration is always taking me to .java files, so it all appears to be working ok in this respect.
Refactoring
I tried to refactor a method which is defined in a class in the Android Library. A popup with a "problem" of
Binary references to a refactored element have been found. They will
not be updated, which may lead to problems if you proceed.
However after pressing Continue the refactoring took place without any issues.
I then tried to refactor a method which is defined in a class in the Java Library. I didn't get any popups this time, and the refactoring worked.
The java library aspect might just work these days because the bugs you guys mentioned have been fixed... (I am using Eclipse 4.2.0 with ADT 20.0.3). I thought I would add this answer however incase it helps someone out with issues of Open Declaration jumping to .class instead of .java file.
I found solution. I have to create Android library from my java library as well and then include it as android library as well as Java library , Then I have to reorder build path export items so Android "Library Projects” are last . And well not much work, Now even rename refactoring works , with some warning but works :) , Well I am happy developer again.

Can't import or create new project from samples or downloads on Android/Eclipse

Basically, I need help importing downloaded source or creating a project from sample source programs. I'm looking for step by step instructions for both if anyone can point me there or post the steps.
I'm very new to Android/Eclipse. I have the environments installed and have successfully written a very minor app that works on the emulator and my real Droid X. I cannot, however, get any of the Android samples into a project without errors. I've tried importing, creating from existing source, and etcetera and it's all a mess with errors everywhere.
I have, however, successfully created a new empty project, then brought the components into the project one at a time typing or pasting in code for every file. I'd hover over and import Android and other components as needed. The WiktionarySimple, for example, ran with only a couple of changes and several warnings that I left alone. (I had to add 'formatted="false" in the statements below...)
<string name="template_user_agent" formatted="false">"%s/%s (Linux; Android)"</string>
<string name="template_wotd_title" formatted="false">"Wiktionary:Word of the day/%s %s"</string>
But there has to be an easier way to import! I've done the intuitive and I've followed instructions that I've found, but to no avail. Can anyone give me a complete list as to how to import or create a project from existing source or from source I've downloaded from the web?
Step #1: Start a new Android project
Step #2: In the first page of the Android project wizard, choose the "Create project from existing source" radio button, then click the Browse button and find the directory containing the project
Step #3: Tweak settings to suit, then press Finish
Step #4: If needed (not sure if it is anymore), right-click over the project name, and choose Build Path > Configure Build Path from the context menu, and make sure the Android entry in the checklist is checked
Its quite possible that you are not importing these projects incorrectly and that you are simply running into common problems that occur when importing projects.
For instance your problem involving adding formatted="false" is quite common and due to a change in the strictness of aapt, which is explained in this question. It is likely that the sample project was created before the change and has not been updated since.
That error involving the formatted="false" can also cause many more errors, since any xml after that error is often not parsed and thus any resources declared after it are not known. So the error No resource found that matches the given name (at 'hint' with value '#string/search_hint') and others like it are often due to the formatted="false" error. I would suggest fixing all the % sign errors with the formatted="false" then letting it rebuild and see how many errors are left.
As for the String types not allowed (at 'layout_width' with value 'match_parent') a quick search on stackoverflow says that its caused because FILL_PARENT was replaced with MATCH_PARENT in Android 2.2. So you need to set your sdk for the project to be Android 2.2 or higher. Here is the link to that question as well.
This happened to me in importing the wiktionary sample and i found the solution.
Import the project through existing code
Right click project and choose properties
In 'Android' Tab the default choice is the minimum API. Changed it to the latest(highest API)
Click ok.
Clean and build your project and errors will be gone
(probably optional)
6. Change the target and Minimum SDK in the Android Manifest

Conversion to Dalvik format failed with error 1 with javax/net/SocketFactory.class

Encounter this problem when trying to Build Project getting such output in console:
[2010-07-19 23:29:23 - myProject]
trouble processing "javax/net/SocketFactory.class":
[2010-07-19 23:29:23 - myProject]
Attempt to include a core VM class in something other than a core library.
It is likely that you have attempted to include the core library from a desktop
virtual machine into an application, which will most assuredly not work. If
you really intend to build a core library -- which is only appropriate as
part of creating a full virtual machine binary, as opposed to compiling an
application -- then use the "--core-library" option to suppress this error
message. If you go ahead and use "--core-library" but are in fact building
an application, then please be aware that your build will still fail at some
point; you will simply be denied the pleasure of reading this helpful error
message.
[2010-07-19 23:29:23 - myProject] 1 error; aborting
[2010-07-19 23:29:23 - myProject] Conversion to Dalvik format failed with error 1
I was looking for my project to use the package javax, not found, clean all also does not help. what I am doing wrong?
Update
Sorry guys, but I could not find good fix for that, I want to emphasize the fact, that i dont use SocketFactory class in my project at all! source code was not changed before this problem, and that's why i think that problem in eclipse or adt or something else, BUT if i use ant(generated by sdk) to build this project there is no problem!!!
I solve this problem by removing Eclipse, Android SDK, Eclipse workspace, and just reinstall them, after this all works fine for now.
Hope this will help someone.
I had the same problem..
This worked for me
project-->properties->java build path->libraries-> remove all including android jars
now go the project browser, right click on the project you are working on,
then android tools---> fix project properties...
do a clean and then build...
I solved the problem (at least for me).
Here's what I did:
Go to Project » Properties » Java Build Path » Libraries
Remove all except the "Android X.Y" click OK.
Go to Project » Clean » Clean projects selected below » select your project and click OK.
That did the trick for me.
Hope it works for you as well
Update: well actually I might have to retract my opinion.. the actions removed the error messages but now I am missing certain classes and methods... arggghhhh
I just restarted Eclipse, and the error didn't appear anymore!
I had the same problem,and solved it as follows:
First clean all jars; (This problem must because your some jars)
Delete the project;
Reimport project;
Make sure your sdk is right, and project select one sdk version;
(This is my issue to solve the problem) Right click your project, and select "build-path", next select "add Librarys", and add your private jars;
clean-build, the problem has fixed;
I just had the same problem and I tried all of the solutions listed here with no success (I was starting to get annoyed). Then I removed the project from the workspace and then imported it again, and there were no problems!
This happened to me this way,
I have a quite an old project which I had to start working again today. I use 'Universal Image Downloader' library for basically every project where I have to deal with lots of images. So in this old project I had the source files of 'Universal Image Downloader' included to it's 'src' path. Back then I was a newbie and slowly I started developing my own library which could handle every day simple Android development tasks very easily. Obviously I included the 'Universal Image Downloader' to this.
After dusting off the old project today the first thing I did was to reference my library to speed up the development process but as I was trying to debug I ran into the "Conversion to Dalvik format failed with error 1" over and over again. First I thought it was the support library but even after clearing all libraries and adding only mine and doing a quick 'Fix project properties' I still got it. After trying various solutions I noticed this in the console "java.lang.IllegalArgumentException: already added: Lcom/nostra13/universalimageloader/cache/disc/BaseDiscCache;"
It was as simple as that... I'm trying to compile a class which has already been compiled.
Solution : I just simply removed all the class files I got from 'Universal Image Downloader' library from the 'src' directory. Since my library references "Universal Image Downloader" library the old project started working just fine.
Hit same problem shown on your log when trying to run an example project which was imported into eclipse.
Additional Info: in eclipse's Problems View I see the following error:
"The project cannot be built until build path errors are resolved"
In my case the imported project find the libraries just right(by just right I mean I can see the external path to each of the android libs in this case 2 libs, android.jar and maps.jar). So no shuffling of libs in my case, but might be your problem.
I followed Spock's suggestion of cleaning the project which I had to clean multiple times until it somehow resolve its issues. After, issue was solved I had to specify an AVD for the project to run and soon after was up and running on the emulator. Also, note that my eclipse is set up to Build Automatically.
In my case I'm not missing any class files or anything after the clean as the build is properly generating them.
Regards!
I was getting the same error. My problem was that i had an android device hooked up to debug with. As soon as I unplugged it I was able to export.
The answer I found was checking the source and library build path in the project's properties. Most likely there will be a duplicate as in something being referenced in both the source and library tabs. So delete the extra in the source tab and then clean the project and you should be good to go.
Either:
javax.net.SocketLibrary is in your source code, or
javax.net.SocketLibrary is included in a JAR file in your project
Under certain conditions it gets its knickers in a twist and the best fix I've found is to remove referenced jars, clean, add them back in and then compile again.
I believe the error can be caused by including the same classes twice.
This error will also occur (and you won't be able to get rid of it by cleaning) when using classes that are not part of the Android environment.
To summarise the information in the link bimbim.in provided (well my understanding when I glanced over it)
The Android Davik VM tries to compile the jars but finds some stuff that it can't compile to .dex files
so
Just create a "lib" directory in the root of the project (where the src, bin res directories are) and add them to the build path. Project Properties... Java Build Path... Libraries.. Add JARs..
I could resolve this issue by creating a new project, looks like the some project settings were creating this issue and could not really find the root cause for that. But, dumping the existing source code onto the new project resovled this issue. If anyone has found the root cause for this problem pls do let me know.
I had the same problem and solved it as follows:
- Go to Project/Properties/Java Build Path/Libraries and remove all JARs except Android
- Do a project clean
- Add the JARs again as External JARs (first time I added them internally, so that might be the problem)
After that the error was gone.
I solved the problem by updating available packages in the Android SDK et AVD manager. No need to remove Eclipse.
Whenever the Project is having the ambitious data. This problem is caused. May be android can't able to find which one choose.
From what I understand, this same cryptic error could be caused from a wide variety of reasons. I've got "Conversion to Dalvik format failed with error 1" error too. In my case the problem was that for some reason Project -> Properties -> Java Compiler was not set to "Enable project specific settings" with proper Java 1.5 settings, but was left to defaults instead (1.6 in my case). Debug, build and test on devices/emulators worked fine, but export always failed with the above error message.
If unsure about the proper settings, create the same project on some alternative location and just copy all needed files from the old project into the new one. This fixed the issue for me.
The next problem with the same error message came from using proguard. Updating to the latest version by replacing the one that came with android sdk, fixed that.
Hope this helps
My problem was having a jar file in my src folder. Removing jars from the build path works, but only if you don't need the jar in question. For people who need the jar in question, make sure that your jar file is not in the project folder (maybe just src subtree, but I would keep it separate to test). Put it on your desktop or something and try the "Add external jar.." option. Be sure to remove the jar from the project filesystem before adding another external. Having both is what causes the problem.
I have done it as the instruction of the first answer and it works.(Linux)
I think the problem may caused by SDK or ADT updates.
I do have to clear all the lib in Java Building path and then use android tools to fix the project. After cleaning and rebuild, it works as before.

Categories

Resources