Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Swapping build platform to Android deletes GooglePlay files

Discussion in 'Android' started by kavs, Jan 14, 2018.

  1. kavs

    kavs

    Joined:
    Jun 29, 2012
    Posts:
    25
    Hey all!

    I have a project on bitbucket and have been working on my PC for a while, but recently set up Sourcetree on my Mac so I can work on my project on my commute. Everything seems to load and run fine except it refuses to compile anything related to Google Play.

    The two errors are:
    1. "The type or namespace name 'PlayGamesClientConfiguration' could not be found. Are you missing an assembly reference?"
    2. "The name 'PlayGamesPlatform' does not exist in the current context."

    I read that this may be because I'm set up to build PC/Mac, and that switching to Android may make this problem go away. When I switch platforms to Android, everything in the Asset/Plugins/Android folder is deleted from my project. :(

    Answers to any of the following questions would be greatly appreciated:
    1. Does anyone have any idea if the build needs to be configured for Android for these compiler issues to go away?
    2. What can I modify in my local code to ignore the Google code if in a different configuration? I tried #if UNITY_ANDROID around my calls to GooglePlay but I can't tell if it's working or just commenting it out always. Is this the best way? It doesn't show up in intelligence as a valid define to use (nor UNITY_IOS).
    3. I am not configured for Android on my Mac; I don't have the Android SDK installed and I don't have the Java SDK. Do I need to be configured to have the project open? I was hoping as long as I didn't try to build an .apk it would be okay.
    4. Why is it deleting my local files in Asset/Plugins/Android when I switch projects from PC to Android?

    My PC and Mac are both running Unity 2017.3.0f3. I use Visual Studio on the PC and Mono on the Mac, if that matters at all. I'm using the latest version of the Google Play plugin, 0.9.42.

    Thanks for any help you can provide!
     
  2. kavs

    kavs

    Joined:
    Jun 29, 2012
    Posts:
    25
    I found these in the console logs. Maybe when it tries to install, it fails and just deletes the file for some reason?

    Error expanding /(censoredPathname)/Assets/Plugins/Android/play-services-auth-10.2.6.aar err: 1: No Java runtime present, requesting install.

    UnityEngine.Debug:LogError(Object)
    GooglePlayServices.DefaultResolver:ExtractAar(String, String[], String)
    GooglePlayServices.ResolverVer1_1:ShouldExplode(String)
    GooglePlayServices.ResolverVer1_1:LoadAarExplodeCache()
    GooglePlayServices.ResolverVer1_1:.ctor()
    GooglePlayServices.PlayServicesResolver:.cctor()
    UnityEditor.EditorAssemblies:processInitializeOnLoadAttributes()
     
    Last edited: Jan 15, 2018