googleanalytics / google-analytics-plugin-for-unity

Google Analytics plugin for the Unity game creation system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not locate google-play-services_lib with Google Play services 31

stanislasbonifetto opened this issue · comments

My environment is:
SO: OSX 10.11.5
Unity: 5.3.3f1
Android Studio : 2.1.2
SDK Tools: Google play services 31

I have installed with the SDK Manager the Google play services 31.
My Unity JDK path is right configured.

I have tried to configure the google play services jar with the Unity menu "Google Analitycs -> setup -> Install google-play-service-lib".
Unity has give me this error:
Could not locate google-play-services_lib in: /Library/Android/sdk/extras/google/google_play_services/libproject/google-play-services_lib
UnityEngine.Debug:LogError(Object)
GoogleAnalyticsSetup:InstallPlayServicesLib() (at Assets/Plugins/Editor/GoogleAnalyticsMenu.cs:46)
GoogleAnalyticsSetup:OnGUI() (at Assets/Plugins/Editor/GoogleAnalyticsMenu.cs:35)
UnityEditor.DockArea:OnGUI()

The problem is that in the last version of Google play services SDK are not included the folder "libproject"

I installed google play services 32. I have same error too.

Anyone help ?

Hi.

  1. Import JarResolver to your project.
  2. Insert GoogleAnalyticsDependencies.cs to some Editor folder.
using Google.JarResolver;
using UnityEditor;

[InitializeOnLoad]
public class GoogleAnalyticsDependencies {


    /// <summary>
    /// The name of your plugin.  This is used to create a settings file
    /// which contains the dependencies specific to your plugin.
    /// </summary>
    private static readonly string PluginName = "GoogleAnalyticsDependencies";

    /// <summary>
    /// Initializes static members of the <see cref="SampleDependencies"/> class.
    /// </summary>
    static GoogleAnalyticsDependencies() {
        PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance(
                PluginName,
                EditorPrefs.GetString("AndroidSdkRoot"),
                "ProjectSettings");

        svcSupport.DependOn("com.google.android.gms",
                "play-services-analytics",
                "LATEST");
    }
}

The Jar resolver and GA dependencies are now included in the v4 plugin.