cannot resolve symbol 'google' in android studio - android

var origin = new google.maps.LatLng( location.latitude, location.longitude );
The above code shows error as cannot resolve symbol google. which google api i have to use in order to resolve it.

In Eclipse goto File ⇒ Import ⇒ Android ⇒ Existing Android Code Into Workspace
Click on Browse and select Google Play Services project from your android sdk folder. You can locate play services library project from
android-sdk-windows\extras\google\google_play_services\libproject\google-play-services_lib
Importantly while importing check Copy projects into workspace option

Make sure you have added Google Play Services Library as Library
project.
if problem persists update your Google Play Service Library by SDK
Manager.
do Clean and ReBuild project.
please restart your Eclipse or andorid
studio,
refer :https://developers.google.com/maps/documentation/android-api/

Related

Imported Project in Android Studio can't resolve ActivityRecognnitionClient

I imported a project from Eclipse to Android Studio. It uses Activity Recognition and Location Services. Now, this Android Studio project can resolve :
1) GooglePlayServicesClient(com.google.android.gms.common.GooglePlayServicesClient) and even
2) DetectedActivity(com.google.android.gms.location.DetectedActivity)
but can't resolve ActivityRecognitionClient(com.google.android.gms.location.ActivityRecognitionClient).
What might be the issue?
I think you are not including Google play services in your project structure properly. go to your project structure and Import the latest maven for google play services

Android import google play service in eclipse error

i try to add google play service in my app( i mean Google map) i added play service in sdk manager and i imported library in eclipse but i library contains errors.in eclipse has error
and also in console i have like this message
"google-play-services_lib] Unable to resolve target 'android-9'"
but i downloaded and installed
Android API version from adt 9
java build Path > Android Dependencies.how i can solve this problem ? what is a solution if anyone knows solution help me
P.S
i 'm new user in this site
welcome
this is a result
Right click on google-play-services_lib projects and select properties and change the target od project
Make sure you have project.properties in the project. It's needed by eclipse.
If you don't have it, kindly copy it from another existing android project, clean and rebuild your project.
Clean your google-play-services_lib project. Check the property of your library project which may have error in java build path. You have to tick the google-play-service.jar in Order and Export tab.

Google play services induces errors in my project

I am trying to add a Google+ sign in button in my app so that I can use the youtube API and provide an easy access to the user. However recently I updated my sdk and now on importing the google-play-services_lib in my workspace and further integrating the services in my project using the standard importing procedure (Project --> properties --> Android | add library) results in an red exclamation mark on my project and when I try to run it gives me a dialog which says there are errors in the project)
In Java build part I get an error which can be properly explained by the following screen shot:
How to resolve this issue? I am sure of the path.
Delete play services library from sdk (.../sdk/extras/google location )
Open SDK Manager and re-install play services library. Restart SDK Manager again to take effect.
Go to eclipse--> re-import play-services library from sdk (copy into workspace is optional).
Clean library project by project-->clean option
Go to your project, add this latest imported library to it.
Clean both library project and your project.
This should work..

Exporting an Android Project based on Eclipse

i developed an android project using google-play-services_lib ( using google map ), my project is compiling and working fine as i want , but i want export my project in order to send it to someone else who should continue work on it , how can i include the google-play-services_lib's project in the same package.
PS :i have included the google-play-services_lib as lib
Send the project and your remote partner has to install "Google Play Services" with the Android SDK Manager.
So, the library project of "Google Play Services" is included into the sdk, and is located in <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/ , he only need to import the project to his Workspace.
If you are using Eclipse, import the library project into your workspace.
Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
Update:
or just copy the google-play-services.jar from google-play-services_lib/libs to the folder /libs of your project.
and delete the reference of google-play-services_lib of your project.
more info: Set Up Google Play Services SDK

Where is com.google.android.gms?

Today I updated Android SDK components to the newest version and somehow the whole com.google.android.gms package is gone. Instead, there is only com.google.android.maps with different classes than those in gms package. Is it a big change form Google or have I done something wrong? I have been using GoogleMap and LatLng classes to work with google maps and now I have just errors in my project.
Is it a big change form Google or have I done something wrong?
com.google.android.gms comes from the Play Services SDK, which you attach to your application project as an Android library project. Please check your environment to ensure that you have a valid copy of the Play Services library project and that your application project still points to it.
First off, if you did not run any updates with Android SDK Manager make sure the google-play-services-lib' project is open in eclipse. If this doesn't fix your problem then proceed. Note: eclipse(v22.0.1-685705) will close google-play-services-lib project with a 'close unrelated projects' command. The google-play-services-lib project must be open.
I figured this problem out. Initially, you/I installed Google Play services in eclipse directly from the SDK Path, (SDK Path is displayed on the top left of Android SDK Manager). When you updated Google Play services with the Android SDK Manager it deleted the .project file and now eclipse can't find the 'google-play-services-lib' project and your development project fails to compile. :-(
Solution:
The basic ideal of this solution is to clean out the old 'google-play-services-lib' project in eclipse, which is now defunct and install a new one with the project copied from the SDK path.
Delete the old project:
In eclipse delete any 'google-play-services-lib' project. (In Eclipse see: Project properties-> Android -> Library.)
In In Eclipse see: Project properties-> Android -> Library delete the old entry for 'google-play-services-lib' project. This will most likely have an red 'X' on it.
Install a new one:
Follow the instruction from Google to install 'google-play-services-lib' project. These instruction specify to copy the project out of the SDK install folder; and then how to set up the projects.
http://developer.android.com/google/play-services/setup.html
Notes:
Your name for 'google-play-services-lib' may be different.
The key to remember is that Google play services is not a jar file. It is a project in eclipse. Your, development project references the google-play-services-lib project.
By copying the project folder from the SDK path to another location, this will keep the Android SDK Manager from deleting your eclipse .project file, and causing this problem. The draw back is if you would like to update google play services, you have to remember to do all the steps again.
You will need Google Play Services sdk. You can install it from Android SDK Manager, if you are using sdk for eclipse.
After installing Google Play services, you can import the library project in your Workspace from ..\sdk\extras\google\google_play_services folder. Clean and build it.
Now you can go to the properties of project having problem and select the library project in Android section.
This should work!
Currently library is in Google Repository. To enable it make sure you have downloaded it using Android SDK Manager (down to the very bottom of the list).
For android create project [...] ant CLI-based project
Similar to: How to correctly include the support library in non-Eclipse Android application
The best I could find was https://stackoverflow.com/a/30689979/895245:
copy paste android-sdk/extras/google/google_play_services/libproject/google-play-services_lib directory in the project directory
cd into it and run android update project -p . -t android-22
add <property name="android.library.reference.1" value="./google-play-services_lib"/> to your build.xml.
You can install extras with the android GUI tool, or with this CLI method: Downloading the Android support library from command line
If you just copy paste the .jar in <sdk>/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar under the libs/ directory of the project, it compiles but breaks at runtime because of the required res/values/version.xml which is not included in the .jar.
If using Android Studio you can add the Google Play Services to use the Google Android Maps v2 by adding a dependency to the build.gradle file.
dependencies {
compile 'com.google.android.gms:play-services:3.1.36'
}

Categories

Resources