I am trying to implement the Google Play API into my Application.
Google says to import BaseGameUtils as library and add this library to my project:
this "main" is the BaseGameUtils, I have no idea why it's called "main".
However, here You can see that it's the BaseGameUtils project:
As You may see, there are the three classes, BaseGameActivity, GameHelper and BaseHelperUtils.
No when I try to import the BaseGameActivity I get following:
But strangely, I can import
com.google.example.games.basegameutils.*;
But when importing this, I still can't use the BaseGameActivity.class
What am I doing wrong?
One thing that you have done wrong is that you are trying to import BaseGameActivity into your application project.
I am assuming that you have already done this:
https://developer.android.com/google/play-services/setup.html
Then follow this:
https://developers.google.com/games/services/android/quickstart
In essence, you import the TypeANumber and BaseGameUtils code from the Android samples into your workspace (not into your application project).
Then you confirm that both Google Play services and BaseGameUtils are defined as library projects (Properties .. Android .. Is Library should be checked).
Then IN YOUR APP PROJECT add them as references (Properties .. Android .. Reference ..Add)
But I have just emphasised key steps that I suspect you may have misunderstood or omitted. You have to follow the whole thing carefully. Good luck !
I was working on the latest Google API for detected activity. So Inorder to try that I download the sample code from
http://developer.android.com/training/location/activity-recognition.html
I imported the google-play-service-lib. have set it as a library for my project. I have also checked for required permissions, but I am still getting an error. I have also set target build to Google APIs
import com.google.android.gms.location.ActivityRecognitionResult cannot be cannot be resolved.
I was able to import other samples from google play services folder and they are running fine. Can anyone point out what error I am making ?
Ok I was able to fix it,....after reinstalling and adding and removing google play services for several times.
R u sure added the googleplayservices library if added check both are in same folder(path) are not by opening the project -> properties -> resource
I am trying to setup Google play services using their android-sample project.
I had successfully imported BaseGameUtils and also the google_play_services_lib . After that i imported the sample project Collect all the stars (and added the BaseGameUtils to its build target) to test it.
But It is giving me error ( -- cannot be resolved) on following two imports
import com.google.android.gms.appstate.AppStateClient;
import com.google.android.gms.appstate.OnStateLoadedListener;
I even try to import other example projects but they all are showing same error.
Below is a snapshot of error.
just restart the eclipse and it will build the work space. This helped to solve the issue.
I think your problem is with google Play services library project it is not updated
Remove Library From your Project after that open the sdk manager and downloads any update for Google Play Services
then import the google play services library project from the following path
..../sdk/extras/google/google_play_services/libproject/google-play-services_lib
to your workspace and build and add this project as a library project to your application project
after clean your application and build and run it should work.....
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.