Android Facebook sdk and google cloud messaging JAR problems
Question
I used GCM already, I had libs folder and have the android-support-v4.jar in it and everything was just fine. Now i'd like to use facebook sdk. I'm doing the facebook's tutorial, but when it says that i have to right click on project -> Android tab -> Add... and select FacebookSDk then ok. So after this step,
The
import android.support.v4.content.WakefulBroadcastReceiver;
import com.google.android.gms.gcm.GoogleCloudMessaging;
import android.support.v4.app.NotificationCompat;
cannot be resolved! I Googled a lot, I cleaned the solution, I replaced the android-support-v4.jar with the facebook's android-support-v4.jar, I refreshed the libraries (right click on project->Android tools->Add support library...), I removed the library from the libs folder And now i'm out of ideas.
Anyone solved this problem? What am I doing wrong?
Solution
For com.google.android.gms.gcm.GoogleCloudMessaging
you have to add google-play-services_lib
as a library project (it has nothing to do with the support library).
For the support library imports, you have to copy the android-support-v4.jar
to the libs folder of your project and add it to the java build path of your project.
OTHER TIPS
Facebook SDK comes with certain version of android-support-v4.jar which may or may not be the same version as your project and/or other libraries you are using. make sure that they are all the same version (literally picking a version of this jar and copying it to your project's lib, Facebook SDK's libs, etc). In eclipse, if you look at the "Problems" tab, it should tell you what is wrong.