unity-game-enginebuildandroid-gradle-pluginunityadsexternal-dependencies

EDM4U error when resolving : NullReferenceException "IsGreater"


EDIT : I made a Post issue on Github : https://github.com/googlesamples/unity-jar-resolver/issues/712

I'm stuck for too long on this one, I would really, really appreciate a hand.

I'm on Unity 2022.3.47f1, on Android. Error occurs only when I use the "Custom main Gradle Template" and that I try to resolve with EDM4U (same with latest and older version)

It appeared when I installed the "In App Purcchasing" package while having GooglePlayGames SDK

Here is 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)

And here is my custom mainTemplate.gradle. (That's the default one)

apply plugin: 'com.android.library'
**APPLY_PLUGINS**

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
**DEPS**}

android {
    namespace "com.unity3d.player"
    ndkPath "**NDKPATH**"
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
        consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**PACKAGING_OPTIONS**
}
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**

Thanks for your time


Solution

  • Solved here : https://github.com/googlesamples/unity-jar-resolver/issues/712#issuecomment-2386068835

    I've used unitypackage instead of UPM registry and use minimum API Level 24 and target API Level set the highest possible API (35 in my case)

    Edit : Download External Dependency Manager unitypackage from here