Error in Android Dependencies , while integrating FB-SDK 3.0 - android

I have tried all the threads related to errors while integrating FB-SDK but was not successful , any answers are welcomed .
My Java Compiler is set to 1.6.
I get this error while integration the Facebook SDK to my App
it is giving me the error at that marked place as
path\facebook-android-sdk-3.0.2\facebook\bin(missing)
i get this error after added this by clicking OK .
Thanks in Advance .

Before moving on, I recommend you to get latest Facebook SDK, because there are some important changes between yours (3.0.2) and 3.0.
Here's what I do to import Facebook SDK
1- Download the latest SDK, extract it to a directory, i.e. X. (~/X)
2- Open Eclipse, New Project -> Android Project From Existing Code, then browse and choose ~/X/facebook-android-sdk-3.0 as root directory
3- Select only "facebook" project and click finish
4- Right click to facebook project -> properties. Choose Compiler Compliance level as 1.6 from Java Compiler section
5- Create new android project, and set it's compliance level 1.6 as well. Also in Android section of Project Properties, Click add button, and choose facebook project (that we imported in Step 3)
6- Finally, Project -> Clean. For me this works like a charm all the time.

Have you checked if you have the facebook jar inside your fb-sdk/bin folder? If it's not there, do a clean and build procedure first in your fb-sdk folder. It will produce a facebook.jar file on your bin folder.
After that, then, you may already do another clean and build on your main project folder.

Related

Facebook Android SDK and IntelliJ IDEA

Has anyone figured out how to use the Facebook SDK with an IntelliJ project successfully? I have tried to create a module, mess with project structure etc, but it does not seem to work on compilation.
Does anyone have an answer to this? All other sources seem to be outdated.
This is what actually worked for me.
However, instead of selecting "Library Module" just hit "Empty Module." This was a pain to figure out, but Intellij will change a bunch of files including the AndroidManifest.xml & Strings.xml if you hit "Library Module." Also, be sure to add the dependencies to the libs folder in the recursed directory to your Facebook module so you include android-support-v4 & bolts support. Should work then.
I am currently using the Facebook Android SDK with IntelliJ.
What you need to do is add the SDK as a library for your project.
First, build Facebook Android SDK using Gradle
Open project settings, under Libraries, select Java
Navigate to the Facebook Android SDK directory, select the facebook sub-directory and click OK
The next screen will show a check-list of items, mostly directories - each of them will be classified as source, class etc.
Uncheck everything, and then check the following items:
facebook-android-sdk/facebook/build/classes/release
facebook-android-sdk/facebook/gen
facebook-android-sdk/facebook/src
Then, click Next/OK/Finish
This might be sufficient, but in my case I had to go the Module settings, Dependencies tab and move the facebook item above the project sources item to get the module to compile.

Importing library in Android Studio

I have little experience with importing libraries. I am using Android Studio, and am trying to use parse.com's library with no luck. I followed these instructions, and tried a few other things when that didn't work. Please help me out. Let me know if you need any more information. Thanks for your time.
This is my MainActivity where I would initialize my Parse client key:
Project Structure showing I have imported the libraries:
UPDATE
Gradle:
UPDATE:
When I try to Build, I get this error: Gradle: error: package com.parse does not exist
When I try cleaning through command prompt
Put the jar into the libs folder
Right click it and hit 'Add as library'
Ensure that compile files('libs/~~~~~~~~.jar') is in your build.gradle file
Do a clean build (You can do this easily in android studio but just as a better method, go to your project folder using windows explorer and open a Command window there by right clicking the folder while holding shift and type gradlew build.
To add to the answer of #ThePoloDoc and for your update Command Prompt image, you need to do the following to clear that error:
Go to Control Panel -> System -> Right Side see for Advanced System settings
Select Environmental Variables
In the new window, search for the PATH variable. Add the java installation folder something similar to C:\PATH_TO_JDK\bin
Replace the PATH_TO_JDK with the installation of your java directory
Try opening the command prompt and you'll see the error gone.
UPDATE:
I have got a doubt in your question. Why do you manually compile gradle? I use Android Studio. But I always click the Sync Project with Gradle Files button on the top. It does everything for me

Creating an Android Test project in Eclipse

How do I create an Android Test project in Eclipse in the target project's /test directory?
Note: I'm just doing my own Q+A for people according to the Stackoverflow FAQ on answering your own question.
I am using Helios with the latest current version of Android (10.0.1)
The Android Testing fundamentals recommends you
place the tests in the same project folder as your src folder. Some people have recommended that you create a new test project in its own folder so it doesn't get packaged into the apk.
I looked inside my apk and I don't think the test stuff was included (but I could be wrong). I like having it in the same directory as its more convenient for revision control - you don't need to sync two projects each time.
Assume we want to create a test suite for the MyAndroidApp project
Goto File.. New.. Other.. Android...Android Test Project
Set "Test Project Name" to MyAndroidAppTest
For Test Target, choose "An existing Android project".. Use the Browse button to select MyAndroidApp
Unselect "Use default location". This changes the location to be inside the MyAndroidApp project under the tests directory
Click Finish
When it is being created, if you get a An internal error occurred during: "Refreshing workspace". error (or other errors) just ignore it. Click OK.
-Clean the MyAndroidApp project
Even though the project is in the <workspace path>/MyAndroidApp/tests directory it will appear as a normal Eclipse project in the package explorer.
Clean the MyAndroidAppTest project.
This worked for me.
EDIT
If you upload to SVN in Eclipse (by syncing the MyAndroidApp project, not the MyAndroidAppTest project) you need to do a little more (I've just done it now).
So when you update your other working copy it will pull down the /tests directory.
The MyAndroidAppTest project does not automatically show up in the Package Explorer.
So you need to go to File.. Import...Existing Projects into Workspace....
Then select the root directory by browsing to your <workspace path>/MyAndroidApp/tests directory and click Finish.
I found here a very detailed solution to this problem. It seems to be an ADT bug.
http://jonblack.org/2012/11/24/creating-an-android-test-project-within-a-project
Still, when I import the test project back into the workspace at Step 5 I get the following error message:
java.io.FileNotFoundException: C:\projects\MyApp\com.myapp.test-test\project.properties ( The system could not finde the file specified ).
I simply closed the error dialog and the test project appeared in my workspace at the same level as my android project, but the location was correctly set to MyApp/tests.
So I wrote a test, run it and it worked.

Cannot Reference LVL Android Library in my App Project

I'm following the instructions found at http://developer.android.com/guide/publishing/licensing.html
I made a copy of the <sdk>/market_licensing directory, then using the New Project Wizard in Eclipse I created a new Android project from Existing source and pointed it at the library subdirectory in my copy of market_licensing.
I've checked the "is Library" box in the market_licensing project android properties.
I've added that project as a library project in my app project. It shows up in the list with a green checkmark.
When I save the project settings and rebuild, the compiler can't find the classes in the LVL project and when I go back into my app's project settings the entry in the libraries list now has a red X instead of the green checkmark.
I don't understand what I'm doing wrong which is preventing me from referencing the LVL project. Any help?
EDIT: I've tried adding the licensing project to my build path for my app project and then I'm able to build, but when I try to run the app crashes because it can't find any of the library code. So clearly the "library" status of the licensing project is not set up correctly and/or its not being automatically injected into my app project on build.
I was posting up a similar question and as I did so realised what the problem was - see here In eclipse, unable to reference an android library project in another android project

Android facebook SDK doing error java.lang.NoClassDefFoundError‎

I have just downloaded the facebook SDK from http://github.com/facebook/facebook-android-sdk
I unpack it from git and opened Eclipse. I then created a new project using existing source and selected the facebook directory. So the sdk project came up correctly (i think). Then I created a new project again using existing source and selected the "Simple" example.
Its came up with errors. I went in the properties and selected Build Path section and added the facebook SDK project and applyed. All the errors disappear.
I then tried to run the Example but im getting an exception on the first call to facebook SDK function ! Exception is NoClassDefFoundError. Its seems that at runtime it cannot find the class of the SDK. How come ? Any suggestions ? Someone did sucessfully run this example ? Any help would be greatly appreciated.
Right click on the Project. Choose Properties -> Android. Under Library click on the Add... button and select the path to the Facebook SDK Project.
I had your same problem, and there was a suggestion in another question thread to export the Android Facebook SDK as a jar file and add that file to your project.
Although some people said that the previous solution worked with them, it didn't work with me!
The only thing worked with me is: coping the Android Facebook SDK six classes into my project and that solved my problem.
Steps:
1- I simply copied the following 6 classes from the Android SDK into my project
AsyncFacebookRunner.java
DialogError.java
Facebook.java
FacebookError.java
FbDialog.java
Util.java
2- I've also copied the facebook_icon.png file from the drawable folders to my drawable folders.
3- I imported my R.java class in the the copied FbDialog.java class.
My advice is to try the jar solution first (as it is the neat way to be a developer), if it didn't work with you, then try my solution (as it is a way to solve the problem).
Thanks and hopefully it will solve your problem.
Mohamed.
I managed to overcome this error by doing a clean build for both my project and facebook library (referenced) project.
The steps:
On Eclipse:
1) Select Project -> Clean
2) Select both your project and facebook sdk project
3) select OK
I too faced the same problem. I was able to overcome this issue by placing the Facebook SDK library as well as my project(to which I want to link the Facebook SDK) within the same workspace. Now go to your project->right click->properties->android->scoll down->add->select the path to facebook SDK->press ok.
This way you can link the Facebook SDK to your project. Only adding the Facebook jar will result in an exception as this does not contain all the classes.
I also had this exception and tried almost everything i found. But then i copied the facebook sdk project to my workspace folder and then referenced it from there in my project and it worked.
Don't know why this happened, this made no sense to me as i was providing it the path while adding reference but anyways, It solved the problem.
I had this same problem. I solved it just by following these steps:
Remove all the sample projects and the Facebook SDK from Eclipse
Import the SDK and sample projects again, but this time, using the "Copy projects into workspace" option checked.
Rebuild the SDK and the sample projects
Working!
Try to mark the check-boxes in Properties -> Java Build Path -> Order and Export.
I had the same problem with the UiLifecycleHelper, and checkig both the Android Dependencies and the android-support-v4.jar worked perfectly. Better to run a clean after that.
I had similar problems. I am building one my lib project (with activities) and my main project using this lib. I had these problems. I had added the lib under the Project properties/Android section and at the bottom, as suggested correctly before, but this wasn't enough (note that both projects were compiling good). I had to change the lib project and use the full path to the layout as:
setContentView(com.example.mylib.R.layout.activity_main1);
Note that using just R.layout wasn't enough, although I have defined the:
import com.example.mylib.R;
Valid alternative is however:
import com.example.mylib.R.layout;
setContentView(layout.activity_main1);
Using Eclipse.
hth to someone
download bolts-android1.1.2 and put into \libs folder. then open the project properties-> java Build Path-> Project tab , Add Facebook SDK. (Facebook SDK libs must be attached with project)
The new facebook SDK already had android.support.V4.jar.
And when you create a new android application, even that contains one.
Hence when you check the console, you get error message called JAR mismatch.
In that case select properties of android project -> Java Build path ->
Select Library tab -> Remove android.support.V4.jar
Select Order and Export and uncheck -> Reference libraries (android.support.V4.jar)
This will fix the issue.

Categories

Resources