googlesamples/unity-jar-resolver

[Bug] NullReferenceException on Unity 2022.3.9f1 and GPGS 11.01

nihilaeth opened this issue · 13 comments

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2022.3.9f1
  • External Dependency Manager version: 1.2.179
  • Source you installed EDM4U: .unityPackage
  • Features in External Dependency Manager in use: Android Resolver
  • Plugins SDK in use: Firebase, Facebook, GPGS
  • Platform you are using the Unity editor on: Windows

[REQUIRED] Please describe the issue here:

  • What's the issue repro rate?
    2/5

  • What happened? How can we make the problem occur?
    After updating GPGS to the to 11.01, i got the error message below when i tried to resolve.

I tried deactivate Jetifier as i saw it could help solve the problem, but i got a similar issue with a MissingMethodException. What triggers me is the locations it try to get the ressource from, because in both errors it try to get from the git repo location, and when i see others issues, it's not the case.

Also, deactivating MainTemplate.gradle in settings solve the problem, but i have a Play.Core dependency issue that need to be fix with MainTemplate.gradle. Actually it's my only way to make a build for google play, but i'm not sure it's safe.

I feel like it's a very specific issue because i saw it anywhere, and i'm not sure it's only EDM4U related.

Google.JarResolver.Dependency.IsGreater (System.String version1, System.String version2) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/JarResolverLib/src/Google.JarResolver/Dependency.cs:196)
Google.JarResolver.Dependency+VersionComparer.Compare (System.String x, System.String y) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/JarResolverLib/src/Google.JarResolver/Dependency.cs:238)
GooglePlayServices.PlayServicesResolver.CheckGradleVersionForJetifier (System.Boolean useJetifier, System.String titlePrefix, System.Action`1[T] complete) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:2581)
GooglePlayServices.PlayServicesResolver.CanEnableJetifierOrPromptUser (System.String titlePrefix, System.Action`1[T] complete) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:2706)
GooglePlayServices.PlayServicesResolver.ResolveUnsafeAfterJetifierCheck (System.Action`1[T] resolutionComplete, System.Boolean forceResolution, System.Boolean isAutoResolveJob, System.Boolean closeWindowOnCompletion) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1752)
GooglePlayServices.PlayServicesResolver+<ScheduleResolve>c__AnonStorey21.<>m__44 () (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1719)
GooglePlayServices.PlayServicesResolver.ExecuteNextResolveJob () (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1576)
GooglePlayServices.PlayServicesResolver.ScheduleResolve (System.Boolean forceResolution, System.Boolean closeWindowOnCompletion, System.Action`1[T] resolutionCompleteWithResult, System.Boolean isAutoResolveJob) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1732)
GooglePlayServices.PlayServicesResolver.ExecuteMenuResolve (System.Boolean forceResolution) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:2032)
GooglePlayServices.PlayServicesResolver.MenuResolve () (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:2048)

This issue does not seem to follow the issue template. Make sure you provide all the required information.

Hi @nihilaeth,

It seems that the Play Games plugin is pointing to version 1.2.169 of the EDM4U. Could you try this version and see if the behavior persists? You may be facing a compatibility issue in your implementation.

Thanks, effectively it show a better sigh of the problem :

  at (wrapper managed-to-native) UnityEngine.Networking.UnityWebRequest.BeginWebRequest(UnityEngine.Networking.UnityWebRequest)
  at UnityEngine.Networking.UnityWebRequest.SendWebRequest () [0x00001] in <47663901d00c4b5488496bbfc25f6e74>:0 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <787acc3c9a4c471ba7d971300105af24>:0 
   --- End of inner exception stack trace ---
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in <787acc3c9a4c471ba7d971300105af24>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <787acc3c9a4c471ba7d971300105af24>:0 
  at Google.PortableWebRequest.StartRequest (Google.PortableWebRequest+HttpMethod method, System.String url, System.Collections.Generic.IDictionary`2[TKey,TValue] headers, UnityEngine.WWWForm form) [0x0019e] in /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/PortableWebRequest.cs:508 
  at Google.PortableWebRequest+<StartRequestOnMainThread>c__AnonStorey6.<>m__C () [0x00000] in /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/PortableWebRequest.cs:458 
  at Google.RunOnMainThread.ExecuteNext () [0x0003d] in /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:486 
UnityEngine.Debug:LogError (object)
Google.RunOnMainThread:ExecuteNext () (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:488)
Google.RunOnMainThread:<ExecuteAllUnnested>m__12 () (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:536)
Google.RunOnMainThread:RunAction (System.Action) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:343)
Google.RunOnMainThread:ExecuteAllUnnested (bool) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:530)
Google.RunOnMainThread:ExecuteAll () (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:512)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

I suspected that, something is blocking the connection.... So i guess this problem is unrelated to EDM4U, but if anyone have an idea, i'd be glad. Could be Facebook SDK?

Thanks anyway

Edit : And now the old error is back...

NullReferenceException: Object reference not set to an instance of an object
Google.JarResolver.Dependency.IsGreater (System.String version1, System.String version2) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/JarResolverLib/src/Google.JarResolver/Dependency.cs:196)
Google.JarResolver.Dependency+VersionComparer.Compare (System.String x, System.String y) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/JarResolverLib/src/Google.JarResolver/Dependency.cs:238)
GooglePlayServices.PlayServicesResolver.CheckGradleVersionForJetifier (System.Boolean useJetifier, System.String titlePrefix, System.Action`1[T] complete) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:2621)
GooglePlayServices.PlayServicesResolver.CanEnableJetifierOrPromptUser (System.String titlePrefix, System.Action`1[T] complete) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:2746)
GooglePlayServices.PlayServicesResolver.ResolveUnsafeAfterJetifierCheck (System.Action`1[T] resolutionComplete, System.Boolean forceResolution, System.Boolean isAutoResolveJob, System.Boolean closeWindowOnCompletion) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1752)
GooglePlayServices.PlayServicesResolver+<ScheduleResolve>c__AnonStorey21.<>m__44 () (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1719)
GooglePlayServices.PlayServicesResolver.ExecuteNextResolveJob () (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1576)
GooglePlayServices.PlayServicesResolver.ScheduleResolve (System.Boolean forceResolution, System.Boolean closeWindowOnCompletion, System.Action`1[T] resolutionCompleteWithResult, System.Boolean isAutoResolveJob) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1732)
GooglePlayServices.PlayServicesResolver.ExecuteMenuResolve (System.Boolean forceResolution) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:2032)
GooglePlayServices.PlayServicesResolver.MenuResolve () (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:2048)

also something i find out that is weird, the settings in EDM4U are not saved properly, if i come back to settings, what i unchecked is sometimes still checked.

Hi, I am having the same issue. Is there a solution already to this?

Unity editor version: 2022.3.28f1
External Dependency Manager version: 1.2.169
Source you installed EDM4U: .unityPackage
Features in External Dependency Manager in use: Android Resolver
Plugins SDK in use: Facebook, GPGS
Platform you are using the Unity editor on: Windows

For now, my workaround is to not use Main Gradle Template, which make me a non blocking error when building. Not sure if it's okay to do that way, but i didn't found other fix.

I created an empty project and put all my assets back in (using git), and updated External Dependency Manager version: 1.2.179 fixed my issue.

I feel like the new External Dependency Manager is the critical step to fix it.

This happened on one of our poorly maintained projects. While the project had EDM installed in UPM, a fellow brogrammer imported some unrelated .unitypackage with embedded EDM. So there are two EDM's now, and it became to behave poorly.

So I cleaned up the project, removed EDM from Assets and everything is ponies and rainbows again.

Hey folks, just bumping up the thread. @nihilaeth, could you confirm if using the latest version 1.2.182 fixes the issue? Thanks!

Hey @nihilaeth. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

Since there haven't been any recent updates here, I am going to close this issue.

@nihilaeth if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

Howdy yall, I recently updated some unity projects from 2021.3.26- to 2021.3.43 and was running into this exception and had other issues with the EDM. Mine were because of this line
<projectSetting name="Google.VersionHandler.VersionHandlingEnabled" value="False" />
in the ProjectSettings/GvhProjectSettings.xml file. I removed it and was able to build, I think it was added from an old SDK as none of my new SDKs were adding it. Good luck!

Edit: Ok I decided to look into this a little bit further. So unity will try to delete this line at build time, but if you import EDM 1.2.182 when the GvhProjectSettings file exsists in the project and this line also already exsists in that file this fails to happen and the android resolver menu wont show. Builds may still succeed though but I dont think the android resolver can run so errors will happen eventually I imagine. Tested in 2021.3.26, not going to go into more detail as this ticket is closed but if it reopens and needs a hand tag me :)

I'm seeing the same issue and none of the suggested changes work. I also tried deleting all resolved libraries and re-resolving them, which didn't help (using the menu options in EDM). This problem appeared after upgrading to Unity 2022.3.39f1 and updating Firebase Analytics, Remote Config and Messaging.

@4314Games or anyone who's experienced with Unity Android projects, my game Stone Story needs help, on a professional basis. Contact me on Discord or Twitter @standardcombo

hey @standardcombo, did you see the line that I mentioned in your project? I think that was causing issues importing the EDM into my project. If you did I would delete that line and the EDM folder and try reimport Firebase/EDM again. If this isnt the case your exception is probably being cause by something else unfortunately.