googlesamples / unity-jar-resolver

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

[BUG] Dependencies conflict for Google Play Services and Google App update (Android Resolver) #535

Closed suchiz closed 2 years ago

suchiz commented 2 years ago

[REQUIRED] Please fill in the following fields: Unity editor version: 2020.3.30f1 External Dependency Manager version: 1.2.172 Source you installed EDM4U: Google Play Services and Google App Update (.unitypackage) Features in External Dependency Manager in use: Android Resolver Plugins SDK in use: None Platform you are using the Unity editor on: Windows 10

[REQUIRED] Please describe the issue here: Hello, I am going through an dependency conflict using EDM for Android.

Initial state: I am using the following: Google Play Services unity package (v0.11.01): https://github.com/playgameservices/play-games-plugin-for-unity/blob/master/current-build/GooglePlayGamesPlugin-0.11.01.unitypackage.

And the following Google App Update unity package (v1.8): https://github.com/google/play-unity-plugins/releases/download/v1.8.0/com.google.play.appupdate-1.8.0.unitypackage

There are currently the latest versions for both of them.

Conflict log:

WARNING: Some conflicting dependencies were found.
The following dependency versions were modified:
com.google.games:gpgs-plugin-support:0.11.01 --> com.google.games:gpgs-plugin-support:+

Display libraries log:

([rootProject] + (rootProject.subprojects as List)).each { project ->
    project.repositories {
        def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
        maven {
            url "https://maven.google.com"
        }
        maven {
            url (unityProjectPath + "/Packages/com.google.play.games/Editor/m2repository") // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
        }
        mavenLocal()
        mavenCentral()
    }
}
dependencies {
    implementation 'com.google.android.play:app-update:2.0.0' // Assets/GooglePlayPlugins/com.google.play.appupdate/Editor/Dependencies.xml:3
    implementation 'com.google.android.play:core-common:2.0.0' // Assets/GooglePlayPlugins/com.google.play.core/Editor/Dependencies.xml:3
    implementation 'com.google.games:gpgs-plugin-support:0.11.01' // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
}
android {
  packagingOptions {
      exclude ('/lib/armeabi/*' + '*')
      exclude ('/lib/mips/*' + '*')
      exclude ('/lib/mips64/*' + '*')
      exclude ('/lib/x86/*' + '*')
      exclude ('/lib/x86_64/*' + '*')
  }

What I tried:

I don't know what else I can do as implementation 'com.google.games:gpgs-plugin-support isn't explicity used by app-update:2.0.0 and core-common:2.0.0. I don't know how to force the version to 0.11.01.

Any help would be helpful ! Thanks !

google-oss-bot commented 2 years ago

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

paulinon commented 2 years ago

Hi @suchiz,

Thanks for reporting this issue. I've imported both packages, but I'm facing a different error message:

Screen Shot 2022-08-22 at 3 48 49 PM

Could you provide the complete steps to reproduce the issue so we can identify what's causing this?

suchiz commented 2 years ago

Hi @paulinon , Thanks for taking a look ! Here how I reproduce this from scratch.

  1. Download both package: https://github.com/playgameservices/play-games-plugin-for-unity/blob/master/current-build/GooglePlayGamesPlugin-0.11.01.unitypackage and https://github.com/google/play-unity-plugins/releases/download/v1.8.0/com.google.play.appupdate-1.8.0.unitypackage.
  2. Create a new 2D project with Unity 2020.3.30f1
  3. Switch plateform to Android
  4. Import GooglePlayGamesPlugin-0.11.01.unitypackage with Assets/Import package/Custom package/GooglePlayGamesPlugin-0.11.01.unitypackage
  5. Auto resolution popup appears: Enable
  6. Resolving Android Dependencies appears: 100% resolved
  7. Check if plugin is installed by looking at Windows/Google Play Games
  8. Import com.google.play.appupdate-1.8.0.unitypackage
  9. Resolving Android Dependencies appears: Library processing complete
  10. Error appears: Resolution failed and another popup appears: Google Version Handler: Would you like to delete obsolete EDM 1.2.169 ? --> apply

You can repeat 9-10 infinitly by force resolving Assets/ EDM/Android Resolver/Force resolve

Thanks again

paulinon commented 2 years ago

Thanks for the additional information, @suchiz. I've done the steps you provided, and I no longer encounter any error message. However, I was using version 2021.3.7f1 of the Unity editor. Could you confirm if updating the editor would be applicable for your use case?

suchiz commented 2 years ago

hi @paulinon , I just downloaded your Unity editor version. The issue remains with the exact same process. Did you try to force resolve again if it was running ?

Could you create a script and see if it finds the Assembly for:

using Google.Play.AppUpdate;
using Google.Play.Common;

and also for

using GooglePlayGames;
using GooglePlayGames.BasicApi;
using GooglePlayGames.BasicApi.SavedGame;

There was a time I thought it was resolved but I couldn't get any of these libraries. It didn't link.

paulinon commented 2 years ago

Hi @suchiz,

I haven't encountered any error messages after clicking Force Resolve multiple times. However, I did encounter a warning saying: Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11: Repo path 'Packages/com.google.play.games/Editor/m2repository' does not exist, will try using 'Assets/GooglePlayGames/com.google.play.games/Editor/m2repository' instead.

Are you facing this warning as well? Could you share the full error log that appears when your resolution fails?

For now, let's keep this issue open in case some of our engineers might have an idea how to resolve this. Feel free to add extra information or details that you might find helpful. Thanks!

suchiz commented 2 years ago

Hello @paulinon :),

I do have this warning but it is slighty different:

Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11: Repo path 'Packages/com.google.play.games/Editor/m2repository' does not exist.
UnityEngine.Debug:LogWarning (object)
Google.Logger:Log (string,Google.LogLevel) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/Logger.cs:129)
GooglePlayServices.PlayServicesResolver:Log (string,Google.LogLevel) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1055)
GooglePlayServices.GradleResolver:RepoPathToUri (string,string) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/GradleResolver.cs:236)
GooglePlayServices.GradleResolver:DependenciesToRepoUris (System.Collections.Generic.IEnumerable`1<Google.JarResolver.Dependency>) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/GradleResolver.cs:279)
GooglePlayServices.GradleResolver:GradleResolution (string,string,bool,bool,System.Action`1<System.Collections.Generic.List`1<Google.JarResolver.Dependency>>) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/GradleResolver.cs:359)
GooglePlayServices.GradleResolver:DoResolutionUnsafe (string,bool,System.Action) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/GradleResolver.cs:928)
GooglePlayServices.GradleResolver/<DoResolution>c__AnonStorey17:<>m__20 () (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/GradleResolver.cs:819)
Google.RunOnMainThread:ExecuteNext () (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:486)
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 ()

and also, here is the full error:

Resolution Failed.

Resolution failed

Failed to fetch the following dependencies:
com.google.games:gpgs-plugin-support:+

UnityEngine.Debug:LogError (object)
Google.Logger:Log (string,Google.LogLevel) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/Logger.cs:136)
GooglePlayServices.PlayServicesResolver:Log (string,Google.LogLevel) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1055)
GooglePlayServices.PlayServicesResolver/<ResolveUnsafe>c__AnonStorey25:<>m__47 (bool,string) (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1913)
GooglePlayServices.PlayServicesResolver/<ResolveUnsafe>c__AnonStorey25:<>m__57 () (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1980)
Google.RunOnMainThread:ExecuteNext () (at /Users/chkuang/Workspace/git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:486)
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 recorded a video where I import packages from scratch. Sorry, I couldn't edit it, it is 8min long... Most of the video is just unity loading ... So here are some times codes: 00:00 -> Creating new project 02:04 -> Project created, switching plateform to Android 02:57 -> Importing GooglePlayGamesPlugin-0.11.01.unitypackage 06:53 -> Enabling Auto Resolution 06:59 -> First package resolved 07:14 -> Importing com.google.play.appupdate-1.8.0.unitypackage 08:15 -> Resolution failed

Thanks for your time !

Additional info: Both packages works well independtly.

chkuang-g commented 2 years ago

Hi @suchiz

I think this is the answer to your issue https://github.com/google/play-unity-plugins#play-core-library-conflicts

Basically, make sure you enable Custom Main Gradle Template and Custom Gradle Properties Template under Player Settings.

Let me know if this works for you.

suchiz commented 2 years ago

Hi @chkuang-g ! Thanks for your help :).

It looks like plugins are imported, dependencies are resolved successfully. The project compiles, and I can run it under the Unity Editor... (Sorry for not reading the README... :( )

But unfortunatly I am unable to build on an Android device:

* What went wrong:
Could not determine the dependencies of task ':unityLibrary:compileReleaseAidl'.
> Could not resolve all task dependencies for configuration ':unityLibrary:releaseCompileClasspath'.
   > Could not find com.google.games:gpgs-plugin-support:0.11.01.
     Required by:
         project :unityLibrary

I am not sure if it is related to this conflict.

Here is what I did:

  1. Download this: https://dl.google.com/games/registry/unity/com.google.play.core/playcore_empty_m2repo.zip

  2. Unzip it to Assets (It looks like this Assets/com)

  3. Enable Custom Main Gradle Template and Custom Gradle Properties Template |--- Assets |++++|--- Plugins |++++|++++|--- GooglePlayGamesManifest.androidlib |++++|++++|+++++++++++++++|--- AndroidManifest.xml |++++|++++|+++++++++++++++| project.properties |++++|++++|--- gradleTemplate.properties |++++|++++| mainTemplate.gradle

  4. Modify local maven repository image

Here is the content of gradleTemplate.properties:

org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
org.gradle.parallel=true
android.enableR8=**MINIFY_WITH_R_EIGHT**
unityStreamingAssets=.unity3d**STREAMING_ASSETS**
# Android Resolver Properties Start
android.useAndroidX=true
android.enableJetifier=true
# Android Resolver Properties End
**ADDITIONAL_PROPERTIES**

Here is the content of mainTemplate.gradle:

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each { project ->
    project.repositories {
        def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
        maven {
            url "https://maven.google.com"
        }
        maven {
            url (unityProjectPath + "/Packages/com.google.play.games/Editor/m2repository") // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
        }
        mavenLocal()
        mavenCentral()
    }
}
// Android Resolver Repos End
apply plugin: 'com.android.library'
**APPLY_PLUGINS**

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
    implementation 'com.google.android.play:app-update:2.0.0' // Assets/GooglePlayPlugins/com.google.play.appupdate/Editor/Dependencies.xml:3
    implementation 'com.google.android.play:core-common:2.0.0' // Assets/GooglePlayPlugins/com.google.play.core/Editor/Dependencies.xml:3
    implementation 'com.google.games:gpgs-plugin-support:0.11.01' // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
// Android Resolver Dependencies End
**DEPS**}

// Android Resolver Exclusions Start
android {
  packagingOptions {
      exclude ('/lib/armeabi/*' + '*')
      exclude ('/lib/mips/*' + '*')
      exclude ('/lib/mips64/*' + '*')
      exclude ('/lib/x86/*' + '*')
      exclude ('/lib/x86_64/*' + '*')
  }
}
// Android Resolver Exclusions End
android {
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

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

    lintOptions {
        abortOnError false
    }

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

If you think that the build issue isn't related to this conflict, I'll close it. Thanks again !

chkuang-g commented 2 years ago

Seems like EDM4U is doing everything it can so far. This could be a Play Unity Plugin issue.

Could you create a ticket at PUP repo here and reference this bug?