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?
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.
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.
Related
I am new at android programming, I am using ADT Bundle (Android Developer Tools, "eclipse+plugin SDK"), I wanted to use google maps, so I installed google_play_services from SDK manager, and when I added this line to my code
import com.google.android.gms.maps.GoogleMap;
the next error appeared
The import "com.google" cannot be resolved
I have already looked in the internet, and I found some propositions that didn't work, and others for the older versions of SDK (<=2013).
It talks about .jar file of google_play_services (to import it to the library) in /extras/google/google_play_services/libproject/google-play-services_lib/
that doesn't exist (libproject/google-play-services_lib/) in the SDK folder that I have, and I can't either find the .jar file.
If you have a solution, I'll really appreciate your help!
Best Regards, Maya
You cant add play lib as jar, you need to add lib as project
import google-play-services_lib from android SDK support folder as an existing Android project (check "Copy projects into workspace")
clean newly added google-play-services_lib project
Right click on your project select properties and add library project to it
Make sure play lib and project using same Andrid version and then clean your project
For more detail about steps to import play lib see
Importing google-play-service library showing a red X next to this reference android
I am learning the android tab with swipe functionality using material theme. I have a sample tutorials from here and it is build from Android studio.
I am currently using eclipse for my project.
I am following the tutorial and i can't import the TabLayout from com.android.support:design
Below is the code,
import android.support.design.widget.TabLayout;
Showing the error, The import android.support.design cannot be resolved
I downloaded support:design:23.0.1 from here and imported to eclipse, even then the error appears.
Can any one tell me where to download and import the com.android.support:design:23.0.1 in eclipse.
Thanks
Install Android SDK 23.0.1
Import design library from sdk\extras\android\support\design into eclipse workspace
To mark the design project as Library, open properties -> Select Android ->Check Library
Now import this design Library to your Project from project properties.
This worked for me in Tab material design.
If the design folder is not found in the said location, try to locate it in sdk\extras\android\m2repository\com\android\support\design instead, especially for the later version.
I have also face same problem then find solution like this.
It work for me hope same for You.
First Step:- find .aar file for design-23.0.1.aar
E:\new sdk\sdk\android-sdk-windows\extras\android\m2repository\com\android\support\design\23.0.1
Second Step:- copy that file and rename it like design-23.0.1.jar to be extract this.
After unzip it you find classes.jar, res, AndroidManifest etc.
Third Step:- Create Library project in eclipse Named design and copy
classes.jar in libs folder
all res in res/
replace AndroidManifest.xml
and last add lib appcompat-v7 by right click on lib project -> properties-> Android -> add -> appcompat-v7
Most important do not forgot clean project and can be restart eclipse for refreshing eclipse.
And more deep details follow steps Guided by commonsware's blog
Create an empty directory that will be the home for the Android
library project. For the rest of these steps, I will refer to this as
“the output directory”.
Copy the AndroidManifest.xml, res/, and assets/ directories from the
AAR into the output directory.
Create a libs/ directory in the output directory. Copy into libs/ the
classes.jar from the root of the unZIPped AAR, plus anything in libs/
in the AAR (e.g., mediarouter-v7 has its own JAR of proprietary
bits).
Decide what build SDK you want to try to use. You might just choose
the highest SDK version you have installed. Or, you can use the
android:minSdkVersion and the -vNN resource set qualifiers to get
clues as to what a good build SDK might be. If desired, create a
project.properties file with a target=android-NNN line, where NNN is
your chosen build SDK. Or, you can address this in Eclipse later on.
Import the resulting project into Eclipse, and if needed adjust the
build SDK (Project > Properties > Android). Also, you will need to
attach to this library project any library projects it depends upon
(e.g., mediarouter-v7 depends upon appcompat-v7).
Good Luck!
And Special thanks to commonsware !!
A great fix to that problem is that you copy the sdk\extras\android\support\design\libs\android-support-design.jar file to "libs" folder of your project
I am trying to import the Support v7 library to get ActionBarActivity however it is not working. I am unable to extend ActionBarActivity.
I followed the tutorials of adding the support library in from these links
https://developer.android.com/tools/support-library/setup.html
http://hmkcode.com/add-actionbar-to-android-2-3-x/
I followed these line by line however i cannot import android.support.v7.app.ActionBarActivity; it seems to not exist. All i can import is android.support.v7.app.appcompat.R;
I am using Eclipse
Can someone help me out please. Many Thanks!.
This is the summary of what I have done which is working now
Went to SDK manager. Checked that I have the latest Android Support Library ( I have Rev 20). I did not install Support Repository as this is for android studio
Imported existing code into workspace. Selected sdk/extras/android/support/v7/appcompat/. I did NOT check copy to workspace.
right-click each .jar file and select Build Path > Add to Build Path. For example, when creating the the v7 appcompat project, add both the android-support-v4.jar and android-support-v7-appcompat.jar files to the build path.
Right-click the library project folder and select Build Path > Configure Build Path.
In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files.
Uncheck Android Dependencies.
what I did differently was Create a new Android project rather than using an existing. By default it seemed to extend ActionBarActivity automatically since I put min SDK to API 8.
What it also did was actually do all the steps above for me! I see new project in my work space appcompat-v7
The only problem I see is on console it said something like unable to write Java cache. I lost the message but I will post it
You can create a new Project(if possible) with the viewpager activity and select actionbar in the settings. This will automatically import it into your NEW project. If you can copy your old files that'd be great.
You basically have to:
Import the android-support-v7-appcompat to your Eclipse as described on these links you read.
Link your own project with 'android-support-v7-appcompat' by going to Project Properties / Android/ Add the 'android-support-v7-appcompat' under the 'Library' section (there's a 'Add' button).
I’m trying to get the facebook sample projects to code. Right now all my inports that begin with
import android.support……..
have a error that says
“the android port android.support cannot be resolved.”
I compared the face book project to a project I made. I found that my project had a folder called android dependencies and under that the file android-support-v4.jar. The facebook project did not have this.
I’m assuming this is why the face book projects are giving me the error. How would I put the file android-support-v4.jar. into my face book projects?
Try the following options:
As mentioned in comments by #yugidroid, try right clicking on the project->android tools->fix project dependencies.
add manually through project's properties, library tabs, add external jar and point to support lib you have downloaded.
right click on project->android tools->download support lib
I have imported and added the facebook sdk for my android project. But in my project under gen folder, then under com.facebook.android folder I get only R.java file. Please help me to get this solved.
You have to import it into your workspace and configure it as a library ( Properties/Android/Library Is Library checked)
then import it into your project under Properties/Android/Library Add the facebook project
Check that the facebook project is in your build path Properties/ Java Build Path/ Projects
And then you should see it under Android Dependencies
You can do it the other way round, instead of importing the facebook library just copy the entire package com.facebook.android into your project.... Thats it.... no need to import any thing.....