Importing Google-Play-Service Library Showing a Red X Next to This Reference Android

Importing google-play-service library showing a red X next to this reference android

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

Android Sample Image 18

import google-play-service dependency red cross

Try to copy the google-play-services_lib next to your project's directory and open it from there.

Also you don't have to use Google Api's anymore - you can use Android Api.

importing google play service reference to my map project

The Google BaseGameUtils should be defined as a LIBRARY project and you should add it as a REFERENCE in your project.

Please see the guide provided by Google at: https://github.com/playgameservices/android-samples/blob/master/README.md which I found to be reasonably accurate.

This may also help:

Google Play Game Services leaderboard - Unable to set jars up correctly in Eclipse

Good Luck !

Importing libraries to existing project in eclipse causing a lot of trouble

I figured it out. I just had to put all jars in libs folder and then download all 3 libraries, The one missing was causing all the trouble.

Unable to add library to android project

Make sure that the libraries and the project are at the same place, i.e.

  1. Copy the libraries in the same folder as your project
  2. Import the libraries (file > Import > Existing Project in workspace)
  3. Open properties of library > Android and select Is Library
  4. Open project properties > Android > Add (library)
  5. LSelect the library
  6. save the properties

If this does not work for you copy the jar files from its lib folder and paste it in the projects lib. This should only be done if the above method doesn't work

Google Maps v2 : how import google-play-service.jar into Android Dependencies

Assuming a layout inflation error

Primarily caused by inflation of wrong fragment type based on imports.

Case 1: If you are using a MapFragment in your FragmentActivity or Activity, using the import android.support.v4.app.*(i.e. Your class extends the Activity or Fragment Activity from the this package), then you will get ClassCastException

Solution Use a SupportMapFragment

<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>

then use the code to get the map in your Activity.

SupportMapFragment mapFragment = ((SupportMapFragment) this
.getSupportFragmentManager().findFragmentById(R.id.map));

Case 2: If you are using a SupportMapfragment in your FragmentActivity or Activity ,using the import android.app.* (i.e. Your class extends the Activity or Fragment Activity from the this package), then also you will get ClassCastException

Solution: Use a MapFragment

<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>

then use in the code to get the map reference in your Acitivity

MapFragment mapFragment = ((MapFragment) this
.getSupportFragmentManager().findFragmentById(R.id.map));

Also, the play services need not to be specifically in the Android Dependencies folders, as Android Private folder is too added to your build path.

Referencing jar file of google play service in map v2 project

import “google-play-services_lib”.
Select File-->Import
Select Android-->Existing Android Code into Workspace
Browse and select \sdk\extras\google\google_play_services\libproject
Select “google-play-services_lib” and finish.
for detailed steps have a look at to my blog: http://umut.tekguc.info/en/content/google-android-map-v2-step-step



Related Topics



Leave a reply



Submit