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
Related
when i import google play service into my ecplise it shows error in appinvite_style.xml file
Error Location : res->values-v21->appinvite_styles.xml
<!-- Base preview application theme. -->
<style name="Theme.AppInvite.Preview.Base" parent="#android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar"/>
appinvite_styles.xml
and also i tried to import appcomport-v7 but it throws the error in that folder too.
API Level :19 (4.2.2)
thanks in advance
The important thing in adding a library in eclipse is to remember that your project and the library project need to be in the same workspace.
To solve this follow below ways,
You can copy the google-play-services library project to the same workspace where your main project is there.
else
While importing the library to eclipse remember to check copy projects into workspace which will add a copy of the library to your workspace.
Please refer this:
eclipse android can not import google play services library
Am trying to import google-play-service library in my workspace for developing google map application.
i follow these steps,
In sdk manager i downloaded playstore lib
I checked in android-sdk\extras\google\google_play_services\libproject\google-play-services_lib and also found library file
while importing i am getting error message that no project to import
i tried clean the workspace, restart the workspace also.
i am using API 21, System config 64-bit
I search a lot for same problem but I cant get a proper solution. i dont know where i am wrong. please help me where i am wrong. Thank you
one possibility are there
this message arise when your project already imported
so try it to create new work-space and then import it will be imported.
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 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.
Am trying to add google-play-service library in my project using import(For Google map). After adding the path am getting red X next to this reference and the reference is not adding . Know how to resolve this ?
The red X means its a broken link path.
http://developer.android.com/google/play-services/setup.html
Copy the google-play services_lib library project to your workspace (folder where your android map project is). The library project can be found under the following path.
<android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib library project .
Import the library project to your eclipse
Click File > Import, select Android > Existing Android Code into Workspace, and browse the workspace import the library project. You can check if it is library project. Right click on the library project. Goto properties. Click Android on the left panel. You will see Is Library checked.
Right click on your android project. Goto properties. Choose Android on the left panel. Click on Add and browse the library project. Select the same. Click ok and apply
Eclipse does weird things when importing an existing project (google-play-services-lib), especially if you try to import and then allow the project to be automatically 'copied' to your workspace. I had the same issue and here is how I fixed it:
Close Eclipse
Erase all google-play-services projects from your workspace
Manually copy the google-play-services-lib folder (....sdk\extras\google\google_play_services\libproject\google-play-services_lib) into your workspace
Open Eclipse
Add a new project, choosing 'Existing Android Project', then navigate to your workspace and add the newly copied google-play-services-lib project
Finally, add the google-play-services-lib to your project as a library (just like you normally would)
Hope this helps! :)
Though it's over a year for this question but never the less thought of putting it down here. Might help some one facing a similar issue.
While doing a File -> Import one probably might have selected the folder,
C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\
instead of
C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\libproject\google-play-services_lib
Quite strange as Eclipse did not correctly copy the google-play-services_lib project in my workspace, but this caused a cross mark to appear in my Project Properties.
got a perfect solution for your question. this problem is due to improper referencing of library projects. You need follow these step.
create a new project
copy all the java files from src of your previous project in which you are getting error to the new project you have created just now.
Also copy layouts xml files.
now import play services you will not get this error.
I was also getting same problem.
I copied google library folder into work space and import now it's working fine.
Try to place the Google-play-service library with in your same working Directory by coping the files from Click File > Import, select Android > Existing Android Code into Work space, and browse the work space import the library project.
This is common issue Youur google-play-service-lib project and your android project should be inside the same folder For example
if your Android Appplication name is MyMap is in D:/workspace t hen your play service lib project should be in the same directory D:/workspace
Close Eclipse. Delete
.metadata
and
.recommaditions
folders from your workplace. Import your projects back.
You add Project in to your workspace.
Start Eclipse and import project one option is ther copy to workspace do it.
After that add google play services it also copy in to your work space
and add it your library hope so its working.