adding library for google map api v2 in android - android

I cannot add google play service library project in my existing android app project to implement google map. Android dependencies are also not been added in the existing app project. It shows me error. I am always trying to add it from my saved sdk manager folder in my adt bundle but the library project is not added. Though I have imported the google_play_service_lib project in my package explorer. Please some body help me.
Thanks in advance.

RightClick On Project->property->Android->Add->select google play services lib ->Apply->ok

Go to: Your Drive:\android-sdk-windows\extras\google\google_play_services add it in your eclipse, if this will added if you have completed whole process of google map.

Make sure that your library and project in the same Workspace.
RightClick On Project->properties->Android->Add->select googleplayservices library->Apply->ok

Try Like this,
File>New>Project>Android>Android Project from Existing code>Browse: Navigate to adt-bundle-windows-x86\adt-bundle-windows-x86\sdk\extras\google\google_play_services> Select libproject
Then you can add this Library project in your own project.
Hope this will help.

Import the android project library "google-play-services_lib" in your Eclipse workspace.
File > Import > Android > Existing Project in WorkSpace.
Select path to google play services library. Click Ok.
Go to your Project Settings (right click project).
then go to Android Tab in left.
Under library section click ADD to add the library project. Apply the settings.

Related

GoogleApiClient cannot be resolved

I am working in Google App Indexing for my project.
Newbee for this feature. I just following the google guide lines.
Notify the google using API
In this page,asked to create an instance of GoogleApiClient. I tried but getting "GoogleApiClient cannot be resolved a type" error.
And I have added the following libraries into my project.
1.Google play services
2.Google api client
3.Google http api client
and
the error is
How can I resolve this error?
Copy the library project at /extras/google/google_play_services/libproject/google-play-services_lib/ to the location where you maintain your Android app projects (your projects folder).
Import the library project into your Eclipse workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it (browse to the google-play-services_lib folder).
In your app project, reference Google Play services library project (right click on project, Properties, Android, click on Add..., select google-play-services_lib folder).
After you've added the Google Play services library as a dependency for your app project, open your app's manifest file and add the following tag as a child of the element (this is a new requirement as of updated Google Play Services):
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Then add this statement in your class (or fix the error):
import com.google.android.gms.common.api.GoogleApiClient
For Android Studio, follow directions here:
https://developers.google.com/android/guides/setup
If you update SDK all...
Remove "google-play-services.jar" in libs directory.
Import google-play-services_lib project in SDK ([your-sdk]\extras\google\google_play_services\libproject\google-play-services_lib)
Click your Project > Right Click > Properties > Click Android > Click [Add] button in the Library section and add google play library.
And... Fix the Red alerts(?) :)
I hope this helps you...

Android: cannot import BaseGameUtils successfully in Eclipse

I want to use game api in my android project.
And I get started by following the instructions described in Google Site
(the part - Setting up your game project) from the following link.
https://developers.google.com/games/services/android/init
I have downloaded the library BaseGameUtils from this link
https://github.com/playgameservices/android-samples
Then I import it as a project as described in instruction.
However, what I've got is a project named main but not BaseGameUtils.
And then I cannot called its BaseGameActivity in my android project.
How can I solve it?
Same issue solved differently.
I've imported the BaseGameUtils project and also couldn't refer to it.
If you right-click the BaseGameUtils project that you've just imported and then go to properties > android and check "is library" you are able to refer to it in your app project.
Solved.
When importing project, not to select BaseGameUtils folder, but the root folder 'android-samples-master'. Then check the project named BaseGameUtils.
This worked for me:
Download code from github, https://github.com/playgameservices/android-basic-samples
In the downloaded folder copy the files from
android-basic-samples-master\BasicSamples\libraries\BaseGameUtils\src\main\java
to
android-basic-samples-master\BasicSamples\libraries\BaseGameUtils\src\main\src
Now import android-basic-samples-master as an android project.
Choose only BaseGameUtils , you'll get a project called main, right click project > properties > android
Add library and select google-play-services_lib and also tick isLibrary and OK.
Also add an external jar android-support-v4.jar by right clicking project > properties > Java Build Path > Add external Jar .
Now add this project named main to your actual project as a library. TADA !
SOLVED.
You must follow: From the command line run Scripts/make_eclipse_compat (or Scripts/make_eclipse_compat.cmd on Windows). This creates the directory structure needed to import the projects correctly.
Attention: android-basic-samples-master > Script/make_eclipse_compat.cmd
Ref: https://github.com/playgameservices/android-basic-samples
Adding to SEG.Veenstra's answer "....just imported and then go to properties > android and check "is library" you are able to refer to it in your app project" this link as there are problems in Google's documentation: Android Play Services Leaderboard cannot be installed (BaseGameUtils)
This is the original Directory structure from this playgameservices github link
android-basic-samples->BasicSamples->libraries->BaseGameUtils->
Change your BaseGameUtils project directory structure to this:
Now try importing this BaseGameUtils project into your Eclipse workspace.
Right Click on BaseGameUtils project->properties->Android->Check Is Library
Right Click on "YourProject"->properties->Android->Add->BaseGameUtils
Apply & OK.
Now BaseGameUtils is linked with your project

library projects cant be found and R.java wont be built.

I have a couple of libraries which are not being detected in my eclipse project.
The problem is its showing up with a cross in properties -> Android
How can I resolve this issue?
first delete google play services from eclipse and clean project
For google play services first install Google play Services
SDK Manager -> Extras -> Google play Services
after installing go to
File->import->your SDK folder path ->extras->extras/google/google_play_services/libproject/google-play-services_lib
Do not copy-paste these libraries inside your 'libs' folder. Instead, import those to your workspace(not from libs folder) and refer them from there.
RightClick On Project->property->Android->Add->select google play services lib ->Apply->ok
In order to use Library project in your application, all library project should be imported first in your working Workspace
How to add Library projects
RightClick on Your Project> Go to Properties >Android>Click on Add
Then add all the required library project
Then click Apply then Ok
Hope this will help you..

How to import a new project in android app properly?

I am making an android app which uses google maps api v2. I want to use the clustering features so I am following the tutorial here
http://karnshah8890.blogspot.ca/2013/04/clustering-on-google-map-v2.html
and using the android maps extension plugin
http://code.google.com/p/android-maps-extensions/
The problem is how do I import this project in my app. I tried doing file > import, then browse for the folder called android-maps-extensions then right click my project folder then click properties then add the reference to the android-maps-extensions. Right after that, I get tons of errors in my project about needing to import R. If I try that, I get other errors.
Does anyone know how to fix this?
Thanks.
I had the same problem and I've found a solution:
right-click on android-maps-extensions
select "Android Tools / Add Support Library..."
right click on your project
in the Android section, remove the google-play-service library and keep only the android-maps-extensions
do a clean up, and it should work
try:
New->other->android->Android Project from Existing Code
point to the root dir(android-maps-extensions-1.3.1)
then select android-maps-extensions
[finish]
this is a library project
then you need to add this library to your project:
right click on your project->properties-Android-> scroll to the bottom to the Library section then hit add and select android-maps-extensions.

How to add google-play-services.jar project dependency so my project will run and present map

I have following problem:
I try to use SupportMapFragment from com.google.android.gms.maps.SupportMapFragment which is part of Google Maps Android API v2.
My first approach was to add project to Eclipse from android-sdk\extras\google\google_play_services\libproject\google-play-services_lib location and set it as referenced project in Properties -> Project References menu of MyApp. I also added project to Java Build Path / Projects. Error indicators disappeared from Eclipse but when I tried to run my app I got NoClassDefFoundError exception.
So my second approach was to copy jar file from google-play-services_lib/libs to my project's libs directory. MyApp succesfully started but in LogCat I can see dead code ... something message so I guess that jar file has to be referenced in another way.
And now I am confused and tired..
Maybe someone more experienced in Android can tell me what should I do ?
The quick start guide that keyboardsurfer references will work if you need to get your project to build properly, but it leaves you with a dummy google-play-services project in your Eclipse workspace, and it doesn't properly link Eclipse to the Google Play Services Javadocs.
Here's what I did instead:
Install the Google Play Services SDK using the instructions in the Android Maps V2 Quick Start referenced above, or the instructions to Setup Google Play Services SDK, but do not follow the instructions to add Google Play Services into your project.
Right click on the project in the Package Explorer, select Properties to open the properties for your project.
(Only if you already followed the instructions in the quick start guide!) Remove the dependency on the google-play-services project:
Click on the Android category and remove the reference to the google-play-services project.
Click on the Java Build Path category, then the Projects tab and remove the reference to the google-play-services project.
Click on the Java Build Path category, then the Libraries tab.
Click Add External JARs... and select the google-play-services.jar file. This should be in [Your ADT directory]\sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs.
Click on the arrow next to the new google-play-services.jar entry, and select the Javadoc Location item.
Click Edit... and select the folder containing the Google Play Services Javadocs. This should be in [Your ADT directory]\sdk\extras\google\google_play_services\docs\reference.
Still in the Java Build Path category, click on the Order and Export tab. Check the box next to the google-play-services.jar entry.
Click OK to save your project properties.
Your project should now have access to the Google Play Services library, and the Javadocs should display properly in Eclipse.
What i have done is that import a new project into eclipse workspace, and that path of that was be
android-sdk-macosx/extras/google/google_play_services/libproject/google-play-services_lib
and add as library in your project.. that it .. simple!!
you might require to add support library in your project.
Be Careful, Follow these steps and save your time
Right Click on your Project Explorer.
Select New-> Project -> Android Application Project from Existing Code
Browse upto this path only - "C:\Users**your path**\Local\Android\android-sdk\extras\google\google_play_services"
Be careful brose only upto - google_play_services and not upto google_play_services_lib
And this way you are able to import the google play service lib.
Let me know if you have any queries regarding the same.
Thanks
Some of the solutions described here did not work for me. Others did, however they produced warnings on runtime and javadoc was still not linked. After some experimenting, I managed to solve this. The steps are:
Install the Google Play Services as recommended on Android Developers.
Set up your project as recommended on Android Developers.
If you followed 1. and 2., you should see two projects in your workspace: your project and google-play-services_lib project. Copy the docs folder which contains the javadoc from <android-sdk>/extras/google/google_play_services/ to libs folder of your project.
Copy google-play-services.jar from <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/libs to 'libs' folder of your project.
In google-play-services_lib project, edit libs/google-play-services.jar.properties . The <path> in doc=<path> should point to the subfolder reference of the folder docs, which you created in step 3.
In Eclipse, do Project > Clean. Done, javadoc is now linked.

Categories

Resources