[Bug] NullReferenceException: Object reference not set to an instance of an object Google.JarResolver.Dependency.IsGreater
Plyrni opened this issue · 8 comments
### [REQUIRED] Please fill in the following fields:
- Unity editor version: 2022.3.47f1
- External Dependency Manager version: 1.2.183 (But also happen in other versions)
- Source you installed EDM4U:** registry package.openupm.com
- Features in External Dependency Manager in use: Android Resolver
- Plugins SDK in use: GooglePlayGames (v0.11.01) + Unity In App Purchasing (4.12.0)
- Platform you are using the Unity editor on: Windows
### [REQUIRED] Please describe the issue here:
Steps to reproduce bug :
1 - Make new project
∟ Mine is Unity 2022.3.47f1 URP on Windows
2 - Add GooglePlayGames plugin : https://github.com/playgameservices/play-games-plugin-for-unity/tree/master/current-build
3 - A Warning appear : Non-secure network connections disabled in Player Settings (Followed by an error but we don't care)
∟ Allow it in ProjectSettings -> Player -> Other Settings -> Configuration -> Allow downloads over HTTP
4 - Add EDM4U registry
∟ Name : package.openupm.com
∟ URL : https://package.openupm.com
∟ Scope : com.google.external-dependency-manager
5 - Install EDM4U through Package Manager
6 - Switch project to Android
7 - Popup appear about auto resolution, just Disable (Annoying otherwise)
8 - Force resolve
∟ Conflicting dependency detected
∟ Get stuck at 100%, with no succeed or failed popup
9 - To fix it : Open "GooglePlayGamesPluginDependencies.xml" located in "Assets/GooglePlayGames/com.google.play.games/Editor/"
∟ Replace "Packages/com.google.play.games/Editor/m2repository" with "Assets/GooglePlayGames/com.google.play.games/Editor/m2repository"
10 - Force resolve doesn't work at this point, so close the editor and open it again
11 - Delete resolved libraries
12 - Force resolve
∟ Resolve succeed
13 - Build APK (I'm using LZ4HC)
∟ Build success
14 - Add Unity package "In App Purchasing"
15 - Delete resolved libraries
16 - Force resolve
17 - Try building
∟ Error : Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
18 - Enable Custom template : (located in Player Settings -> Publishing Settings -> Build
∟ Custom Main Gradle Template
∟ Custom Gradle Properties Template
∟ Custom Gradle Settings Template
∟ Note : I'm not sure we need Properties and Settings to trigger the bug, that's simply what I've done
19 - Delete resolved libraries
20 - Force resolve
21 - There you should have the error :
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.MenuForceResolve () (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:2056)
What's the issue repro rate? 100% repro rate
Here is a downloadable project that reproduce the bug : https://we.tl/t-jrlWny5Uzo
This issue does not seem to follow the issue template. Make sure you provide all the required information.
I recently started a new project, and my setup is nearly identical to this. Running into the exact same issue.
Unity Version: 2022.3.45f1
EDM Version: 1.2.169 (included in latest Google Play Games plugin)
I'm still stuck on it
Hey folks, thanks for reaching out. So far I'm unable to reproduce the same behavior. Here's what I did:
- Create project with Unity Editor
2022.3.47f1and use Android platform - Using
Assets > Import Package > Custom Package..addEDM4U1.2.183 - Using
Assets > Import Package > Custom Package..addGooglePlayGamesPlugin-0.11.01.unitypackage - This will trigger ED4MU auto resolution, resolve and remove duplicate EDM4U files version
1.2.169fromGooglePlayGamesPlugin - Build And Run - Builds successfully
- Using
Window > Package Manager > Add package by nameaddcom.unity.purchasingversion4.12.2 - An error of not found packages of EDM4U version
1.2.169is shown - Use
ResolveandForce Resolve - Build And Run - Builds successfully
The stacktrace seems to point to an issue with the AGP version. Could you try updating your Minimum API level to 24 and your Target API level to 34 and higher?
Quick update on my end, I tried similar steps to what @argzdev listed. The exact details are below:
- Still on Unity 2022.3.45f1
- Imported EDM4U 1.2.183
- Imported GooglePlayGamesPlugin-0.11.01
- It showed that it would replace(?) EDM4U 1.2.183 files, but in the end, it looks like it auto updated or something as it still shows I have version 1.2.183
- Changed my minimum API level to 24 and maximum API to latest (should resolve to 35)
- Attempted to build
At this point I ran into a different error, but I was able to resolve the error following this post: https://discussions.unity.com/t/build-failing-with-google-play-services-plugin-could-not-find-com-google-games0-11-01/319041/4
I've now successfully built my apk!
My play games authentication still fails, but that should be a completely different issue.
Issue still here on my side
-
Move to Min API 24 and target Highest possible API
-
Removed EDM4U 1.2.183
-
Installed back EDM4U 1.2.183 (via registry, but it should be the same)
-
Imported GPGP 0.11.01 again via unityPackage
∟ No error, no replacement of any sort during process. Unlike you guys -
Resolve and build succesfull
-
Installed Unity Purchasing 4.12.2
∟ No errors after install -
Resolve and Force resolve successful
-
Build failed
∟ Execution failed for task ':launcher:checkDebugDuplicateClasses'. -
Enable Custom Main Gradle Template to fix the duplicates manualy
-
Resolve and Force resolve fail
∟ The same error I mentionned above :
NullReferenceException: Object reference not set to an instance of an object
Google.JarResolver.Dependency.IsGreater (System.String version1, System.String version2)...
OK, I finally did it!
Apparently the issue was UPM registry
- Move to Min API 24 and target Highest possible API
- I removed the UPM package
- Removed the ExternalDependencyManager folder
- Installed EDM4U 1.2.183 from unity package found here
- Assets -> Refresh
∟ External Dependency Manager appeared but didn't showed the resolver - Assets -> External Dependency Manager -> Version Handler -> Update
∟ He found an obsolete file, I applied what he proposed. - Android resolver appear in External Dependency Manager
- Force resolve suceed instantly (good sign that it works)
- Build succeed
Interesting, so I guess the underlying issue is having redundant dependencies or sub-dependencies on both UPM and Custom Package which the EDM4U cannot resolve correctly. Thank you for sharing your updates, @txukiakari, @Plyrni. I'm sure this'll help guide other folks who encounter this issue as well. That said, since the issue has been resolved. I'll go ahead and close this thread.