NoClassDefFoundError when running Facebook official example - java

Sorry I am new, stackoverflow does not
allow me to post image and links...
I try to use Official Android SDK (http://github.com/facebook/facebook-android-sdk/). I install the SDK and try to run the Example
At first, it fails at "build", it cannot find the Facebook SDK, so I try to follow the steps found in SDK page:
Add a dependency on the Facebook
Android SDK library on your
application:
from the File menu, select "Properties"
once the project Properties are displayed, open the Android section,
which should list the build targets
and libraries
in the bottom "Library" section, click "Add..." and select the Facebook
SDK project
refer to http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject
for more details
I check the link at #4, it shows a Mac OS X version Eclipse, which has Library section, but on my Vista PC, with Eclipse 3.5.2, it does not have Library section...
-http://developer.android.com/images/developing/adt-props-isLib.png
-http://farm5.static.flickr.com/4138/4852346022_fc8f6bedbe_b.jpg
I try to add the Facebook SDK in Java Build Path. Now it can "build" and start, on both Emulator and Device. However, once it started, it crash, the logcat shows:
ERROR/AndroidRuntime(518): java.lang.NoClassDefFoundError: com.facebook.android.Util
-http://farm5.static.flickr.com/4138/4852346048_f4a3b998a3_b.jpg)
I searched around, about "NoClassDefFoundError" program, but seems those solution is solving external JARs files. I have no problem adding other JARs files, and this Facebook SDK is not JAR...
I tried Clean, rebuild, delete everything and config again, but can't solve this problem yet.
Anyone have idea please help, Thanks.

This exception is thrown if a class could not be found at runtime even if it was available when the program was compiled. You need to double check that the SDK jars are available to then program in the launch configuration. This includes the jars being physically present ón the device.

Related

Trouble installing ADT plugin in eclipse (for developing android apps)

I already had Eclipse (kepler) installed to create java programs.
Now I wanted to develop android apps, so I wanted to install the ADT plugin for Eclipse.
I read the following:
http://developer.android.com/sdk/installing/installing-adt.html#Download
I did those steps exactly.
Then, on that same page, I read this paragraph:
http://developer.android.com/sdk/installing/installing-adt.html#Configure
But I don't understand what I have to do.
When Eclipse restarts, I get a popup diolog which asks me to choose a path which has to lead to a folder. I can't find any folder. I don't see anything changed in my file system.
I don't see any folder which looks like Android SDK. I think I am missing something.
You need the SDK as well. You can find it here:
https://developer.android.com/sdk/installing/index.html?pkg=tools
When you install it you have to insert the path of your SDK in the Eclipse popup dialog
I encourage you to update the SDK on your first launch through SDK manager

Android Facebook SDK no class def found com.facebook.android.Facebook

I'm using a version of the Facebook SDK, I'm not sure which version as I was given the eclipse project and told to use it but it was given to me before SDK 3.0 was released, so most likely 2.0, in an Android app. The app's project has the SDK project listed as a required project to enable us to prompt for Facebook login within the app.
I've tried telling eclipse to export the project with or without the Facebook project but it makes no difference.
I have also tried running the app both with and without the official Facebook app installed.
Every time I try to initiate the login for Facebook, I get the message:
01-24 19:05:11.863: E/AndroidRuntime(12697): Caused by: java.lang.NoClassDefFoundError: com.facebook.android.Facebook
Any help or insight is greatly appreciated.
As it turns out, one of my team-mates loaded up the project from Git, compiled it, and ran it with no changes and it works just fine. Clearly something is messed up with my setup somewhere whether it is with the Facebook SDK or Eclipse. I'm running Eclipse Juno, he is running Eclipse Indigo.
This turned out to be because I hadn't included the library project in the "Android" section of the project's properties.

How to run maven project on google app engine

I follow this tutorial: http://software.danielwatrous.com/wordpress-plugin-licensing-wicket-on-google-app-engine/. I add google app engine library to this project and then I want to check google app engine on. But when I do this eclipse has this problem:
The App Engine SDK '/home/hudi/program/git/tournamenSystem/tournament-system/
tournament-system-web/src/main/webapp/WEB-INF/lib/appengine-api-1.0-sdk-1.7.1.jar'
on the project's build path is not valid (SDK location '/home/hudi/program/git/
tournamenSystem/tournament-system/tournament-system-web/src/main/webapp/WEB-INF/
lib/appengine-api-1.0-sdk-1.7.1.jar' is not a directory)
I dont understand it. Jar isnt directory so why it want to some directory ? When I want use quick fix then I can just use another SDK. I try to use older version 1.6... but still same problem. How I can fix it ? Please help
Possible solution is that, you should add appengine through app engine settings in eclipse and make sure that the sdk added by appengine setting appear before the one mentioned (i.e. /home/hudi/program/git/tournamenSystem/tournament-system/tournament-system-web/src/main/webapp/WEB-INF/lib/appengine-api-1.0-sdk-1.7.1.jar) in your build path. In this way your application would refer the appengine sdk from google plugin and not for the path which is giving error.
I had same issue where I was getting error for the sdk jar included from maven dependency.Hope it will help.
You may want to take a look at the Maven GAE Plugin
This plugin has goals to run, debug, deploy, etc. your GAE application.
On my computer with Ubuntu 12.04 and Eclipse Juno SR1
I just move all maven dependencies to the button of the list of Java build path.
For open Java build path window right click on the project
- preferences
- Java build path
- Order and Export
- select all row with M2_REPO(or some thing else) and press button "Bottom"
- Refresh project.
This need help.
Thank you!

How can I modify the DroidGap.class file from phonegap-1.0.0.jar archive in eclipse?

I am really very new on android development.
I have made 2-3 apps , those running on my android device already.
Last few days I am facing a stupid problem.
The problem is , creating the app fullscreen for every device. I have read phone gaps wiki
and tried with specific way. But I failed everytime.
When I'm trying to open the DroidGap.class from my Android eclipse project explorer , I got a error. that, "DroidGap.class has no source attached". (after build the phonegap.jar)
Please help me....
first you need to add phonegap.jar to your project
you need to add phone gap plugin to your eclipse
Use the AppLaud Eclipse Plugin for PhoneGap Android
Download and unzip the PhoneGap sources from GitHub
In the AppLaud wizard, select "Enter path to installed PhoneGap"
Enter the directory path to the unzipped sources from GitHub
Now you will be able to modify and debug the sources that comprise phonegap.jar
Caveat: I'm the creator of the AppLaud Plugin
fullscreen?
If you want modify DroidGap.class dowload source code from github and rebuild phonegap.
Rebulid instruction here: https://github.com/callback/callback-android/blob/master/README.md

"could not find com_facebook_android.apk error" when running Android project

I've installed the Facebook API for Android in Eclipse, and imported the project into my Android project. My program builds perfectly fine, but when I try to run it I get
Could not find com_facebook_android.apk!
in the build window, and when the program actually tries to import any of the Facebook API classes it blows up with a java.lang.NoClassDefFoundError: com.facebook.android.Facebook
Probably you added the reference to the Java project in the "Java Build Path" but it's the wrong place.
From the Android guide:
To add a reference to a library project, follow these steps:
In the Package Explorer, right-click the dependent project and select Properties.
In the Properties window, select the "Android" properties group at left and locate the Library properties at right.
Click Add to open the Project Selection dialog.
From the list of available library projects, select a project and click OK.
When the dialog closes, click Apply in the Properties window.
Click OK to close the Properties window
This resolved my problem.
Check out referencing libraries instructions here:
http://developer.android.com/guide/developing/projects/projects-eclipse.html
Make sure you have the latest versions of ADT.
Try to clean your project in eclipse.
Hope this helps
In my case helped, not to have in the referenced projects checked Is Library
(Project Properties > Android)
I am also having issues with this error and have noted that if I run eclipse as root then the error disappears. This makes me think it is a permissions issue
So to help:
On the com Facebook android project right click > android tool > build and export
Then simply build the project into the bin folder of the Facebook project.
Problem solved
I had a similar problem. This was my resolution. I had to add android.jar as a reference.
Android samples error
If nothing works, try deleting the Facebook application for Android (if you have one installed on your phone). This worked for me.

Categories