play-games-plugin-for-unity icon indicating copy to clipboard operation
play-games-plugin-for-unity copied to clipboard

ShowLeaderboardUI() AndroidJavaException: java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment

Open CoreySmith1200 opened this issue 1 year ago • 37 comments

Authenticate and report scores works fine. But when I try to call PlayGamesPlatform.Instance.ShowLeaderboardUI() or Social.ShowLeaderboardU() I get error AndroidJavaException: java.lang.ClassNotFoundException:com.google.games.bridge.HelperFragment. I have tried using the Social heavy method and also exclusively using PlayGamesPlatform.Instance methods, none can open a leaderboard and give same error. I am able to upload to internal testing in goole play and test on dev device without google play saying errors.

My project main template gradle uses the new play core that is fragmented (not using 1.10.3) implementation 'com.google.android.play:core-common:2.0.4' // Assets/GooglePlayPlugins/com.google.play.core/Editor/Dependencies.xml:3

Unity 2022.3.50 Android min SDK 24 Android target SDK 34 Play games plugin 0.11.01 EDM4U 1.2.183 also using firebase analytics 12.3.0 also using google play review plugin 1.8.3

I previously was using Unity 2021.3.33 with target SDK 33 and min sdk 22 and firebase 12.0 and everything was working. Note: I have same exact issue when try to upgrade using Unity 2021.3.44 when min SDK 24, target SDK 34, and also updating firebase analytics to 12.3.

I have seen some potentially similar issues but none of their suggestions have had success for me. Generated Local Repo folder is including both gpgs-plugin-support-0.11.01 files with vanilla setup.

error from showLeaderboard

here is my mainTemplate.grade after a force resolve:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
    implementation 'com.applovin.mediation:google-adapter:[23.4.0.0]' // Assets/MaxSdk/Mediation/Google/Editor/Dependencies.xml:5
    implementation 'com.applovin.mediation:unityads-adapter:4.12.3.1' // Assets/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml:4
    implementation 'com.applovin:applovin-sdk:13.0.0' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:4
    implementation 'com.google.android.gms:play-services-base:18.5.0' // Assets/Firebase/Editor/AppDependencies.xml:17
    implementation 'com.google.android.play:core-common:2.0.4' // Assets/GooglePlayPlugins/com.google.play.core/Editor/Dependencies.xml:3
    implementation 'com.google.android.play:review:2.0.0' // Assets/GooglePlayPlugins/com.google.play.review/Editor/Dependencies.xml:3
    implementation 'com.google.android.ump:user-messaging-platform:2.+' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:5
    implementation 'com.google.firebase:firebase-analytics:22.1.0' // Assets/Firebase/Editor/AppDependencies.xml:15
    implementation 'com.google.firebase:firebase-analytics-unity:12.3.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
    implementation 'com.google.firebase:firebase-app-unity:12.3.0' // Assets/Firebase/Editor/AppDependencies.xml:22
    implementation 'com.google.firebase:firebase-common:21.0.0' // Assets/Firebase/Editor/AppDependencies.xml:13
    implementation 'com.google.games:gpgs-plugin-support:0.11.01' // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
    implementation 'com.tenjin:android-sdk:1.16.1' // Assets/Editor/Dependencies.xml:4
// Android Resolver Dependencies End
**DEPS**
}

CoreySmith1200 avatar Oct 15 '24 00:10 CoreySmith1200

Same issue here, not only the Leaderboards but also the Achievements

nicetrysean avatar Oct 16 '24 05:10 nicetrysean

Same issues. Don't work ShowLeaderboardUI and ShowAchievementsUI

brend32 avatar Oct 16 '24 17:10 brend32

Same here... Uploading a project from API 33 to 34 has led me to encounter the same issue.

Unity 2021.3.44f1 Play games plugin 0.11.01 EDM4U 1.2.183

leo3duy avatar Oct 16 '24 19:10 leo3duy

I found out that the com.google.games.* package is not persisted in the DEX classes of AAB build file and why is this happen... (you can just decompile it for check the package path to class)

PoweredByAndrox avatar Oct 18 '24 22:10 PoweredByAndrox

Exact same issue, and with the looming November deadline to upgrade to SDK34, this is quite urgent.. tried many things. I'll report back if I have any luck.. but hopefully someone can help us soon.

frazerbw avatar Oct 19 '24 02:10 frazerbw

What I found is that the file containing the com.google.games.* classes is not included in the final AAB. It seems that EDM4U doesn’t properly resolve the GPGS plugin.

I tried the workaround of copying the gpgs-plugin-support-0.11.01.aar and POM files from:

Assets/GeneratedLocalRepo/GooglePlayGames/... (where the AAR files are supposed to be taken from during the build)

to:

Assets/GooglePlayGames/... (where it actually seems to be taking the AAR files from)

I rebuilt the project in Android Studio, and now the achievements UI and leaderboard open correctly. (I still need to do more thorough testing), but everything seems to be working so far.

leo3duy avatar Oct 19 '24 20:10 leo3duy

It worked

What I found is that the file containing the com.google.games.* classes is not included in the final AAB. It seems that EDM4U doesn’t properly resolve the GPGS plugin.

I tried the workaround of copying the gpgs-plugin-support-0.11.01.aar and POM files from:

Assets/GeneratedLocalRepo/GooglePlayGames/... (where the AAR files are supposed to be taken from during the build)

to:

Assets/GooglePlayGames/... (where it actually seems to be taking the AAR files from)

I rebuilt the project in Android Studio, and now the achievements UI and leaderboard open correctly. (I still need to do more thorough testing), but everything seems to be working so far.

Thankyou so much! This worked!

One tip for other people, as this caught me out initially. When I 'force resolved' after doing the copy paste, I ended up breaking things.

Don't do this. Just copy paste over the POM and AAR (you don't need the meta files). Then build your aab/apk file.

Tested this on the internal track and it worked! :) Very happy!

frazerbw avatar Oct 19 '24 21:10 frazerbw

I solved this issue by using External Dependency Manager v1.2.177

imenekse avatar Oct 19 '24 22:10 imenekse

What I found is that the file containing the com.google.games.* classes is not included in the final AAB. It seems that EDM4U doesn’t properly resolve the GPGS plugin.

I tried the workaround of copying the gpgs-plugin-support-0.11.01.aar and POM files from:

Assets/GeneratedLocalRepo/GooglePlayGames/... (where the AAR files are supposed to be taken from during the build)

to:

Assets/GooglePlayGames/... (where it actually seems to be taking the AAR files from)

I rebuilt the project in Android Studio, and now the achievements UI and leaderboard open correctly. (I still need to do more thorough testing), but everything seems to be working so far.

Thanks to @frazerbw and @leo3duy for solve this bug. It really works!

PoweredByAndrox avatar Oct 19 '24 23:10 PoweredByAndrox

fixed it by checking the 'Android' box under 'Select platform for plugin' in the inspector for gpgs-plugin-support-0.11.01.aar

smuttleralph avatar Nov 05 '24 13:11 smuttleralph

I solved this issue by using External Dependency Manager v1.2.177

This worked for me as well! Thank you very much.

domalagic avatar Nov 13 '24 22:11 domalagic

Solution that survived force resolution is

  1. Move plugin files from Assets/GooglePlayGames/com.google.play.games/Editor/m2repository to Assets/GooglePlayGames/m2repository
  2. Update repository path in GooglePlayGamesPluginDependencies.xml from
        <repository>Assets/GooglePlayGames/com.google.play.games/Editor/m2repository</repository>

to

        <repository>Assets/GooglePlayGames/m2repository</repository>
  1. Resolve dependencies

We are using:

Unity 2021.3.44f1 Play games plugin 0.11.01 EDM4U 1.2.183

(tagging https://github.com/playgameservices/play-games-plugin-for-unity/issues/3092 for visibility)

ValeriyBogorodskiy avatar Nov 25 '24 09:11 ValeriyBogorodskiy

fixed it by checking the 'Android' box under 'Select platform for plugin' in the inspector for gpgs-plugin-support-0.11.01.aar

I use 2.0.0, and this worked for me!

damozhang avatar Dec 29 '24 16:12 damozhang

fixed it by checking the 'Android' box under 'Select platform for plugin' in the inspector for gpgs-plugin-support-0.11.01.aar

I am also using version 2.0.0, it worked! Thank you. But an important warning, if you force resolve, the settings will revert to their previous state. You may need to check again before you build.

onerbatuhan avatar Jan 08 '25 03:01 onerbatuhan

fixed it by checking the 'Android' box under 'Select platform for plugin' in the inspector for gpgs-plugin-support-0.11.01.aar

This does the trick. Also works with 0.10.14. I wonder why devs can't fix such a critical issue. They don't care?

hippogamesunity avatar Jan 23 '25 14:01 hippogamesunity

I am using the latest v2.0.0 with Unity 2022.3x and it worked by enabling the Android platform for gpgs-plugin-support-0.11.01.aar

RidsZee avatar Jan 24 '25 15:01 RidsZee

Passed through this problem here, https://github.com/playgameservices/play-games-plugin-for-unity/issues/3318#issuecomment-2497374461 didn't work here 100%, but I found another fix that worked with EDM4U 1.2.183 and does not break after forced resolving: instead of relying on the buggy behavior of local maven repositories, I'm using the gpgs-plugin-support.<version>.aar directly and using EDM4U only to download its dependencies (which can be found in the gpgs-plugin-support-<version>.pom file).

  1. Rename the gpgs-plugin-support-<version>.srcaar file to gpgs-plugin-support-<version>.aar (changed extension from "srcaar" to "aar"). Unity will detect it as an Android native plugin right away.
  2. In GooglePlayGamesPluginDependencies.xml, instead of declaring com.google.games:gpgs-plugin-support:<version> as a dependency with custom maven repo, we just declare its dependencies directly (these specific versions are from gpgs-plugin-support-0.10.14.pom, change depending on your plugin version):
    <?xml version="1.0" encoding="UTF-8"?>
    <dependencies>
      <androidPackages>
        <androidPackage spec="com.google.android.gms:play-services-games:21.0.0" />
        <androidPackage spec="com.google.android.gms:play-services-auth:19.2.0" />
        <androidPackage spec="com.google.android.gms:play-services-nearby:18.0.0" />
      </androidPackages>
    </dependencies>
    
  3. Resolve dependencies with EDM4U and build normally: Unity will embed gpgs-plugin-support-<version>.aar as expected.
  4. (optional) Move the .aar to another folder and remove the "m2repository" folder, only the .aar is necessary for the build.

gilzoide avatar Jan 29 '25 20:01 gilzoide

using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;

namespace Assets.Plugins.??????????.Editor
{
    public class PreprocessBuild : IPreprocessBuildWithReport
    {
        public int callbackOrder => 999;

        public void OnPreprocessBuild(BuildReport report)
        {
            const string path = "Assets/GeneratedLocalRepo/GooglePlayGames/Editor/m2repository/com/google/games/gpgs-plugin-support/0.10.14/gpgs-plugin-support-0.10.14.aar";

            ((PluginImporter) AssetImporter.GetAtPath(path)).SetCompatibleWithPlatform(BuildTarget.Android, true);
        }
    }
}

hippogamesunity avatar Feb 14 '25 08:02 hippogamesunity

fixed it by checking the 'Android' box under 'Select platform for plugin' in the inspector for gpgs-plugin-support-0.11.01.aar

I had the same issue, and this resolved it for me. Thank you.

lazydevyo avatar Feb 19 '25 20:02 lazydevyo

Still present in 2.0.0, the file is gpgs-plugin-support-2.0.0.aar but same step to fix: checking the 'Android' box under 'Select platform for plugin' in the inspector

Ok google, just fix this, the current version DOESN'T work out of the box!!! It is well identified, easy to fix, and I lost hours on this, as many other probably have

LaCreArthur avatar Feb 24 '25 18:02 LaCreArthur

Haha, they don't want to fix this since Oct 2024.

hippogamesunity avatar Feb 24 '25 18:02 hippogamesunity

This is such a blatant oversight, I don't understand how these amateurs at Google can't fix it.

YeDemirkiran avatar Apr 15 '25 07:04 YeDemirkiran

Hi there)

Hello, I’m using Unity 6 and I’m encountering the same issue: AndroidJavaException: java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment

I’ve already checked the “Android” platform checkbox for gpgs-plugin-support-2.0.0.aar and moved the AAR file to Plugins/Android, but nothing helped.

If anyone has experienced the same issue, please share how you resolved it.

wogulgames avatar May 07 '25 19:05 wogulgames

gpgs-plugin-support

This worked for me, I am using version 2.0.0 of Google Play Games Plugin. search the file name "gpgs-plugin-support-0.11.01.aar" in the project window and In the inspector, under Select platfoms for plugin - > Include platform -> Check Android.

rahulbarate avatar Jun 22 '25 07:06 rahulbarate

Still not fixed, Amazing 💯

CoreySmith1200 avatar Jun 24 '25 19:06 CoreySmith1200

gpgs-plugin-support

This worked for me, I am using version 2.0.0 of Google Play Games Plugin. search the file name "gpgs-plugin-support-0.11.01.aar" in the project window and In the inspector, under Select platfoms for plugin - > Include platform -> Check Android.

hello, how did u find gpgs-plugin-support-0.11.01.aar instead of gpgs-plugin-support-2.0.0.srcaar after upgrading to gpg v2 with clean imstall as suggested in plugin page?

gputhread avatar Jun 26 '25 08:06 gputhread

gpgs-plugin-support

This worked for me, I am using version 2.0.0 of Google Play Games Plugin. search the file name "gpgs-plugin-support-0.11.01.aar" in the project window and In the inspector, under Select platfoms for plugin - > Include platform -> Check Android.

hello, how did u find gpgs-plugin-support-0.11.01.aar instead of gpgs-plugin-support-2.0.0.srcaar after upgrading to gpg v2 with clean imstall as suggested in plugin page?

ProjectUnity\Assets\GeneratedLocalRepo\GooglePlayGames\com.google.play.games\Editor alright enabling platform android worked for me unity 2022.3.62 with EDM 1.2.186 and GPG 2. Thankyou All there are still many errors in latest unity 22 which are unexpected for a old lts tier version, it feels they added issues as there were not many before 🤣

gputhread avatar Jun 26 '25 09:06 gputhread

Still not fixed in 2.1.0, I have to include Android platform on gpgs-plugin-support-2.1.0.aar file every time before building a game.

pou1gray avatar Aug 25 '25 15:08 pou1gray

Enabling it from a prebuild script works time to time.

пн, 25 авг. 2025 г., 18:42 Vasily @.***>:

pou1gray left a comment (playgameservices/play-games-plugin-for-unity#3318) https://github.com/playgameservices/play-games-plugin-for-unity/issues/3318#issuecomment-3220781593

Still not fixed in 2.1.0, I have to include Android platform on gpgs-plugin-support-2.1.0.aar file every time before building a game.

— Reply to this email directly, view it on GitHub https://github.com/playgameservices/play-games-plugin-for-unity/issues/3318#issuecomment-3220781593, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABX2VHGTKONUYDBNYIRHQ3L3PMVFLAVCNFSM6AAAAABP6ACYLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEMRQG44DCNJZGM . You are receiving this because you commented.Message ID: <playgameservices/play-games-plugin-for-unity/issues/3318/3220781593@ github.com>

hippogamesunity avatar Aug 26 '25 06:08 hippogamesunity

[Solution]

If all above attempts didn't worked for you, here is the final solution (probably :stuck_out_tongue_winking_eye: ) to end your suffering. Please follow the following steps.

Step1: Goto Assets>External Dependency Manager>Android Resolver>Settings

Step2: In Android Resolver Settings scroll down to where you see "Browse" button to select "Local Maven Repo Directory". You will see a path written in the input field as "Assets/GeneratedLocalRepo". Simply change it to "Assets".
(Reference Images attached below)

Step3: Goto Assets>External Dependency Manager>Android Resolver>Delete Resolved Libraries

Step4: Goto Assets>External Dependency Manager>Android Resolver>Force Resolve

Doing this will automatically create "gpgs-plugin-support-x.x.x.aar" and "gpgs-plugin-support-x.x.x.pom"under Assets/GooglePlayGames instead of Assets/GeneratedLocalRepo/GooglePlayGames/

Make a build and test!

----------- Reference Images -----------

Image Image

GurriSekhon avatar Sep 11 '25 07:09 GurriSekhon