I'm trying to integrate Google Analytics in my Unity game. I've downloaded and installed the latest unitypackage.
In Unity after clicking on Google Analytics > Setup > Install google-play-services_lib I get this error:
I've installed Google Play Services in Android SDK manager but it does not install the lib. Even the description of the package says it only installs JavaDoc and Sample code, no library:
So the problem is that in the /extras/google/google_play_services/ folder there is no libproject subfolder at all. Only JavaDoc and Samples folders.
I've read the documentation (tab OTHER because I'm not using neither Android Studio nor Eclipse), followed the instructions step by step and it just doesn't work. And my googling turned in vain. How can I install google play services lib?
Have you tried checking the Setting Up Google Play Services Document by Google?
For Android Studio:
Open the build.gradle file inside your application module directory.
Add a new build rule under dependencies for the latest version of play-services. For example:
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.google.android.gms:play-services:fp9.0.0'
}
Save the changes and click Sync Project with Gradle Files in the toolbar.
Note: If the number of method references in your app exceeds the 65K limit, your app may fail to compile. You may be able to mitigate this problem when compiling your app by specifying only the specific Google Play services APIs your app uses, instead of all of them. For information on how to do this, see Selectively compiling APIs into your executable.
For Eclipse with ADT:
Copy the library project at <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/ to the location where you maintain your Android app projects.
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.
In your app project, reference Google Play services library project. See Referencing a Library Project for Eclipse for more information on how to do this.
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 <application> element:
Related
I have an Eclipse project which I want it to be imported inside Android Studio, but got below error:
Project foo:C:\Users\user\Desktop\foo\project.properties:
Library reference ..\..\..\..\..\..\android-sdks\extras\google\google_play_services\libproject\google-play-services_lib could not be found
Path is C:\Users\user\Desktop\foo\..\..\..\..\..\..\android-sdks\extras\google\google_play_services\libproject\google-play-services_lib which resolves to C:\android-sdks\extras\google\google_play_services\libproject\google-play-services_lib
How can I resolve it?
Based from Setting Up Google Play Services:
To develop an app using the Google Play services APIs, you need to set up your project with the Google Play services SDK. If you haven't installed the Google Play services SDK yet, go get it now by following the guide to Adding SDK Packages.
Here are the steps to make the Google Play services API available to your app in Android Studio:
1. Open the build.gradle file inside your application module directory.
Note: Android Studio projects contain a top-level build.gradle file and a build.gradle file for each module. Be sure to edit the file for your application module. See Building Your Project with Gradle for more information about Gradle.
2. Add a new build rule under dependencies for the latest version of play-services. For example:
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.google.android.gms:play-services:10.0.1'
}
Be sure you update this version number each time Google Play services is updated.
3. Save the changes and click Sync Project with Gradle Files in the toolbar.
You can now begin developing features with the Google Play services APIs.
For additional information, you may also visit the following links:
Gradle Plugin User Guide
Android Studio with Google Play Services
eclipse android can not import google play services library
I need to find libproject folder to import Google Play Services to Eclipse, to import google play services on a project.
I install Google Play services 31 in "Android SDK Manager". When access to downloaded path I find:
I last version I have libproject:
¿Where is libproject to import google play services 31 in my Eclipse project?
Google Play services no longer ships a libproject directory and does not officially support development in Eclipse.
You'll have to use an older version or find an unofficial workaround if you want to use (the now completely deprecated) Eclipse.
I was also facing the same issue because I'm still using Eclipse. I was able to integrate Play Services revision 31 in my project using the following steps:
Start Android SDK Manager and choose to install Extras > Google Repository.
Navigate to android-sdk\extras\google\m2repository\com\google\android\gms\play-services-games\VERSION\
Change the extension of the .AAR file to .ZIP and extract the contents into a temporary location.
Go to the extracted folder and create a new directory called "lib", and move the "classes.jar" file into it.
Import the folder into Eclipse as existing Android code. Once imported you may need to set the project as Library and set the appropriate compile API level.
Now go back to the android-sdk\extras\google\m2repository\com\google\android\gms\play-services-games\VERSION\ folder and open up the pom file using any text editor and look at the dependancies section to see which other libraries it depends on.
Repeat the steps again for the new libraries you've identified as dependancies in the earlier step.
You have to keep checking all the dependancies until you've identified all the libraries you need for your project's purposes. For example, my project uses Ads, Cloud Save and Leaderboards/Achievements, so I did this process and ended up with 9 libraries to import into Eclipse (see attached screenshot).
Screenshot
i simply need an OAuth 2.0 token to authorize requests with Google for REST APIs. so I need to import the google play service sdk.
specifically the:
Google Account Login com.google.android.gms:play-services-identity:8.1.0
I am using eclipse I only want to import the Google account login api, but there is no instructions on how to do so.
if there is no solution, how can I grab the Jar referenced in the dependencies for android studio projects https://developers.google.com/android/guides/setup
There is a solution I guess. Try this:
Go to "android_sdk\extras\google\m2repository\com\google\android\gms\play-services-identity\8.1.0\"
Copy "play-services-identity-8.1.0.aar" to your eclipse project's /libs directory.
Open "project.properties" file and add this line: android.libraries.reference.1=libs/play-services-identity-8.1.0/ and Run Application.
And if it didn't work, try setting up your project with com.google.android.gms:play-services-identity:8.1.0 in android studio and import/export gradle project in/for eclipse. It will most probably resolves the included dependencies automatically to work with eclipse.
Hope it helps.
I already added the support for GCM at our android app, however one thing bothers me is about the Google Play services library project. Based on this link Set Up Google Play Services SDK, I should do the following at step 4:
Make a copy of the Google Play services library project.
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.
We are using eclipse. So to allow other developer to build our app project without doing any manual work, I checked in the Google Play services library project into our version control (SVN) and add that project as part of our app project.
However I am not sure whether I should check that project into our source version control or not. One thing I also found out that google-play-services_lib.jar file is modified today, however I didn't do anything to that jar and I don't have any idea how it got updated. Should I check in the new version of the jar file? Again this still goes back to whether I should check in the Google Play services library project in the first place.
Could someone with GCM experience shed some lights what's the best approach here?
Update 1 at Jan 16:
Per the answer below, we could add a Google play services jar file to our app project, however based on this link, Implementing GCM Client, it has the following:
Caution: When you add the Play Services library to your project, be sure to add it with resources, as described in Setup Google Play Services SDK. The key point is that you must reference the library—simply adding a .jar file to your Eclipse project will not work. You must follow the directions for referencing a library, or your app won't be able to access the library's resources, and it won't run properly
So that would means that we could not just simple add the jar file.
Your library compiles first whenever you compile your application, as library projects create jar your Google Play Services jar will be updated on every run.
As the library incluse resources you cant create the jar and add them in to your java build path there two possible ways to get rid of this :
Move to Android Studio which uses .aar files which contains all your andorid resources in archive. Read more from refrence.
Prevent libray project to compile each and every time you run the app in eclipse. Click Here to know how to do that.
The guide to setting up GCM here: https://developer.android.com/google/gcm/client.html specifies:
Caution: When you add the Play Services library to your project, be sure to add it with resources, as described in Setup Google Play Services SDK.
Then the page it links to (https://developer.android.com/google/play-services/setup.html#Setup) never mentions the 'with resources' bit.
Does anyone know what this means, as I fear I've missed something when setting up my play services project.
With recources means as library project, not as JAR file.
Install the Google Play services from SDK manager.
After install it will be at /extras/google/google_play_services/libproject/google-play-services_lib/
So? you can copy this folder in you workspace? if you need.
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.
Add Referense to Google Play services in your project. Example http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
Does anyone know what this means
I suspect that it is a clumsy way of emphasizing that you need to attach the Play Services SDK Android library project to your app, rather than just copying over some JAR.