I´m trying to develop a real-time multiplayer game using google play game services and I download the sample(ButtonClicker2000), but Eclipse ADK keeps complaining that com.google.android.gms.games.GamesClient cannot be resolved.
All of the other imports work fine:
import com.google.android.gms.games.Games;
import com.google.android.gms.games.GamesActivityResultCodes;
import com.google.android.gms.games.multiplayer.Invitation;
import com.google.android.gms.games.multiplayer.OnInvitationReceivedListener;
import com.google.android.gms.games.multiplayer.Participant;
import com.google.android.gms.games.multiplayer.realtime.RealTimeMessage;
import com.google.android.gms.games.multiplayer.realtime.RealTimeMessageReceivedListener;
import com.google.android.gms.games.multiplayer.realtime.Room;
import com.google.android.gms.games.multiplayer.realtime.RoomConfig;
import com.google.android.gms.games.multiplayer.realtime.RoomStatusUpdateListener;
import com.google.android.gms.games.multiplayer.realtime.RoomUpdateListener;
import com.google.example.games.basegameutils.BaseGameActivity;
Does anyone know how to fix this?
GamesClient was a part of the Google Play Services library - google-play-services.jar.
In older versions, you could locate the class if you explore the library. In Eclipse it's probably under 'Android Private Libraries' in your package list. Go down the packages and search for com.google.android.gms.games.GamesClient
Since the Google Play services update to version 4.3, GamesClient is no longer available. You should switch to GoogleApiClient instead.
So if you update your packages from the Android SDK Manager, Google Play Services will be updated to revision 16, released on 17 March 2014. Since GamesClient has been deprecated, it will be missing form the package after you restart Eclipse and refresh the workspace.
This is the official statement:
The previous Games client is deprecated as of February 7th, 2014.
Existing and new developers are strongly encouraged to use
GoogleApiClient instead of the deprecated GamesClient.:
So you either need to replace GamesClient with GoogleApiClient (better), or downgrade your google-play-service lib to the older version (not recommended).
In order to replace GamesClient, you will need to refactor the code. Here is the official announcement and introduction to the new API. Here is one example of an updated sample.
It's likely that the playgameservices samples will be updated, you can issue a ticket the github page of the project for that.
Related
I want to implement Google Play Game Services. But in GameHelper class the following classes could not be found at compilation.
import com.google.android.gms.games.Games;
import com.google.android.gms.appstate.AppStateManager;
import com.google.android.gms.games.multiplayer.Multiplayer;
import com.google.android.gms.plus.Plus;
Error:
The import com.google.android.gms.appstate.AppStateManager cannot be resolved GameHelper.java
I already read the google docs about Game Services and made all like that. In App Billings works great. So I have integrated the library project of Google Play Services in the right way.
Does anyone know something about this problem?
I got the same issue in Helper class like below
import com.google.android.gms.games.Games;
import com.google.android.gms.appstate.AppStateManager;
import com.google.android.gms.games.multiplayer.Multiplayer;
import com.google.android.gms.plus.Plus;
My solution was updating google play services. Now I dont get any error
In the git repository look for classes in: EndlessTunnel\BaseGameUtils\src\com\google\example\games\basegameutils\
This may not be the perfect solution, but the git repository contains 3 directories containing the GameHelper.java (and in the same folder, its related BaseGameActivity.java).
After many hours I've finally managed to get rid of all the errors, but I have yet to test if this will cause any limitations.
Im trying to create my first Google Map app and so i'm following this tutorial:
check_Tutorial there you will see the following imports:
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
My problem is when i get to this point i can not add these imports because when i type them they don't appear as if they even exist!! so that's why i can not continue with my map and i've tried so many times with other tutorials they always appear in order the maps works...
If you know the reason why i can not add these imports please let me know 'cause is driving me crazy!!
Error adding the library!
I forgot to tell you that i receive this image a couple of sec after having added the google play services library:
Please install Google Play Service in your device from Google play store.
and also include libraries in your project.
In Eclipse:
File->Import-> Android-> Existing Android Code into Workspace->Browse-> adt->sdk->extras->google->google_play_services->lib Project.
Click OK,
Remember to check option to import libs into workspace.
add the libraries to the project. Clean the Project and Run.
Reason not import(package) google map library in your project
1)You are not selected Android build Target as google API
->Your project right click properties select as google apis
2)You are not added google play service lib in your project(as Is Library)
->Your project right click properties select as google apis.
Install in your device-
https://play.google.com/store/apps/details?id=com.google.android.gms
You need to reference google play services library project in your android project.
Follow the steps #
http://developer.android.com/google/play-services/setup.html
If using eclipse IDE check this
Importing google-play-service library showing a red X next to this reference android
I'm trying to test LocationService example of Android developer as per following link http://developer.android.com/training/location/retrieve-current.html. At that time, error message show me that "The import com.google cannot be resolved" for following 5 lines. I'm really confused how to solve this problem.
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
You will need the Google Play Services SDK configured within Eclipse and import google play services as library will dismiss this error .
There is a much simpler solution. In my case, I've gone through all the answers from a few sources and none of them give a straight answer to my problem. Finally, I found a sample app source code and when I import the source code I found out adding the library from Google Play Service Library directory solved it. Google Play Service Library is located (for windows user) here:
\sdk\extras\google\google_play_services\libproject
Import the library into Eclipse as a library project and add this library in your actual project will fix it.
EDIT: This guy made a great contribution on his tutorials how to use Android Google Map v2 step by step and very details. It also includes how to use with Android Support package’s backport of fragments.
http://ddewaele.github.io/GoogleMapsV2WithActionBarSherlock/part1
Assuming you use Eclipse.
Right-click on your project -> properties -> Android.
There use Google API's instead of standard Android.
If you're using Android Studio:
Right click on your app folder -> Open Module Settings -> Dependencies -> Click on the plus button -> Choose library dependency -> Search for "play-services" -> Double click on the com.google.android.gms:play-services
Press Ok and wait for Gradle to rebuild.
You can use this way. First of all close projects which are using google-play-services library. Whenever your mouse over the com.google.android.gms import that can not be resolved and towards the bottom of the popup menu, select the "Fix project setup" option as below. Then it'll prompt to import the google-play-services library.
If you're using Eclipse, you can fix this by installing Google Play Services SDK via the SDK Manager, load the google-play-services-lib project into Eclipse, and set this as a reference from your project. This is documented at http://developer.android.com/google/play-services/setup.html
Do you use android sdk with google api? If not, do that and it will work.
set your project properties to google api.
You will need the Google Play Services SDK configured within Eclipse.
Maybe useful for some other developers facing this error:
If you are changing to a newer Android Version and if you are using the android-support-library, you have to beware that all projects that you use as library also have the SAME version of the android-support-library. One example would be the actionbar-sherlock. ;)
It Works = Do you use android sdk with google api? If not, do that and it will work.
In project.properties I had to add the following (for ANT build):
android.library.reference.1=${root_prefix}/${sdk.dir}/extras/google/google_play_services/libproject/google-play-services_lib
If you are using Android studio you may be missing to add gradle to your project.
Add specific play service you want.
Here you may want to compile
com.google.android.gms:play-services-location:10.2.1
Add this to your build.gradle app module in dependencies.
In android studio,add dependency as follows:
In gradle script,go in build.gradle(Module:app) and add these lines
compile 'com.google.android.gms:play-services:10.0.1' in dependencies tag
Here 10.0.1 may be skipped or changed according to your library installed
Can anyone help me to know how to import licensed project, while trying... the following classes cannot be imported.
import com.android.vending.licensing.LicenseChecker;
import com.android.vending.licensing.LicenseCheckerCallback;
import com.android.vending.licensing.ServerManagedPolicy;
import com.android.vending.licensing.AESObfuscator;
Any help will really be appreciated. Thanks
The latest version of the LVL seems to require
import com.google.android.vending.licensing.LicenseChecker;
import com.google.android.vending.licensing.LicenseCheckerCallback;
import com.google.android.vending.licensing.ServerManagedPolicy;
import com.google.android.vending.licensing.AESObfuscator;
instead of
import com.android.vending.licensing.LicenseChecker;
...
(as the current document tells me to do)
It took me a half day to figure this out.. haha
LVL library can be downloaded using the SDK Manager
Link
The License Verification Library (LVL) is a collection of helper classes that greatly simplify the work that you need to do to add licensing to your application. In all cases, we recommend that you download the LVL and use it as the basis for the licensing implementation in your application.
The LVL is available as a downloadable component of the Android SDK. The component includes:
The LVL sources, stored inside an Android library project.
An example application called "sample" that depends on the LVL library project. The example illustrates how an application uses the library helper classes to check and enforce licensing.
To download the LVL component into your development environment, use the Android SDK and AVD Manager. Launch the Android SDK and AVD Manager and then select the "Market Licensing" component, as shown in the figure below. Accept the terms and click Install Selected to begin the download.
i am trying to implement this tutorial but i am getting errors in these line
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.google.android.maps.Overlay;
in WhereAreMyFriendsMap.java
Is there anything else like jar i need to add
Thanks
You have to set your Project Build Target to the Google APIs version of the API level you're targeting. You most likely have it set to Android API.
From the same tutorial, do you have everything they mentioned here?
Getting started is pretty well-worn ground. Pull down the latest Android SDK and JDK (5 or newer). Download and install Eclipse for Java developers (3.2 or newer) and the ADT Eclipse plugin and you're set. There's more detail at StackOverflow, on the Android code site, and the Android support forums.