googlesamples / unity-jar-resolver

Unity plugin which resolves Android & iOS dependencies and performs version management
Other
1.21k stars 336 forks source link

[Bug] NullReferenceException on Unity 2022.3.9f1 and GPGS 11.01 #676

Open nihilaeth opened 3 months ago

nihilaeth commented 3 months ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

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)
google-oss-bot commented 3 months ago

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

paulinon commented 3 months ago

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.

nihilaeth commented 3 months ago

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.

kevinfish356 commented 1 month ago

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

nihilaeth commented 1 month ago

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.

kevinfish356 commented 1 month ago

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.

reflexing commented 6 days ago

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.