Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.Games #3315

Open
rico345100 opened this issue Sep 6, 2024 · 9 comments
Labels

Comments

@rico345100
Copy link

Describe the bug
When I launched my game, stuck in the authentication with this error:

09-07 03:24:57.124: E/Unity(5469): AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.Games
09-07 03:24:57.124: E/Unity(5469): java.lang.ClassNotFoundException: com.google.android.gms.games.Games
09-07 03:24:57.124: E/Unity(5469): 	at java.lang.Class.classForName(Native Method)
09-07 03:24:57.124: E/Unity(5469): 	at java.lang.Class.forName(Class.java:453)
09-07 03:24:57.124: E/Unity(5469): 	at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
09-07 03:24:57.124: E/Unity(5469): 	at com.unity3d.player.UnityPlayer.-$$Nest$mnativeRender(Unknown Source:0)
09-07 03:24:57.124: E/Unity(5469): 	at com.unity3d.player.UnityPlayer$F$a.handleMessage(Unknown Source:110)
09-07 03:24:57.124: E/Unity(5469): 	at android.os.Handler.dispatchMessage(Handler.java:101)
09-07 03:24:57.124: E/Unity(5469): 	at android.os.Looper.loop(Looper.java:164)
09-07 03:24:57.124: E/Unity(5469): 	at com.unity3d.player.UnityPlayer$F.run(Unknown Source:20)
09-07 03:24:57.124: E/Unity(5469): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.games.Games" on path: DexPathList[[zip file "/data/app/me.modernator.extinctionob-eW1PxbR2YdSorynCyxq_rA==/base.apk", zip file "/data/app/me.modernator.extinctionob-eW1PxbR2YdSorynCyxq_rA==/split_config.arm64_v8a.apk"],nativeLibraryDirectories=[/data/app/me.modernator.extinctionob-eW1PxbR2YdSorynCyxq_rA==/lib/a

To Reproduce
Steps to reproduce the behavior:

  1. Build with Unity 2021.3.43f1 and GPGS 0.10.14, EDM4U 1.2.182
  2. Launch the game
  3. Stuck in the authentication process with the above error message

Try "force resolve" and run, authentication passes but when I upload it on Google Play Console, google rejects it with this message:

Update your com.google.android.play:core:1.10.3 Maven dependency to an Android 14 compatible version! Your current com.google.android.play:core:1.10.3 library is incompatible with targetSdkVersion 34 (Android 14), which introduces a backwards-incompatible change to broadcast receivers. As a reminder, from August 31, 2024, Google Play requires all new app releases to target Android 14. Update to the latest library version dependency to avoid app crashes.

Expected behavior
Authentication should be pass, and Google accepts the update

Observed behavior
After setting target API level to 34, only Android 14 users crashed with this error message:

No pending exception expected: java.lang.SecurityException: me.modernator.extinctionob: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

So I updated Unity from 2020 LTS to 2021 LTS, and then 2021.3.43f1, and also updated EDM4U to the latest version but now stuck in the infinite loading in the authentication step, so tried force resolve and it worked, but google rejects the update with this:

Update your com.google.android.play:core:1.10.3 Maven dependency to an Android 14 compatible version! Your current com.google.android.play:core:1.10.3 library is incompatible with targetSdkVersion 34 (Android 14), which introduces a backwards-incompatible change to broadcast receivers. As a reminder, from August 31, 2024, Google Play requires all new app releases to target Android 14. Update to the latest library version dependency to avoid app crashes.

In brief,

  1. "No force resolve", delete all custom gradle files and re-enable custom gradle files asked by EDM4U -> Build -> Stuck in the authentication with "ClassNotFoundException", but Google accept the upload
  2. Try "force resolve", now authentication works but Google reject the update with "Update your com.google.android.play:core:1.10.3 Maven dependency to an Android 14 compatible version! ".
  3. WTF?

Bug Report
Capture a bug report and share the Google Drive link. If the bug report contains sensitive information, then make it private and only give access to requests from [email protected] accounts.

Versions

  • Unity version: 2021.3.43f1
  • Google Play Games Plugin for Unity version: 0.10.14
@rico345100 rico345100 added the bug label Sep 6, 2024
@rico345100
Copy link
Author

Other unity packages used in this project are:

  • Unity Ads 4.4.2
  • Unity IAP 4.12.2

@rico345100
Copy link
Author

According to EDM4U dev, “com.google.android.play:core:1.10.3” is deprecated, so I need to update it.

googlesamples/unity-jar-resolver#707

This is build.gradle found after build aab:

apply plugin: 'com.android.library'


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
    implementation 'com.google.android.play:core:1.10.3' // Assets/GooglePlayPlugins/com.google.play.core/Editor/PlayCoreDependencies.xml:3
    implementation 'com.google.games:gpgs-plugin-support:0.10.14' // Assets/GooglePlayGames/Editor/GooglePlayGamesPluginDependencies.xml:11
// Android Resolver Dependencies End
    implementation(name: 'UnityAds', ext:'aar')
    implementation(name: 'common', ext:'aar')
    implementation(name: 'AndroidNative', ext:'aar')
    implementation project('GooglePlayGamesManifest.androidlib')

}

// 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 {
    namespace "com.unity3d.player"
    ndkPath "C:/Program Files/Unity/Hub/Editor/2022.3.45f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK"
    compileSdkVersion 34
    buildToolsVersion '34.0.0'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

    defaultConfig {
        minSdkVersion 23
        targetSdkVersion 34
        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a'
        }
        versionCode 26
        versionName '1.0.0'
        consumerProguardFiles 'proguard-unity.txt'
    }

    lintOptions {
        abortOnError false
    }

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

    packagingOptions {
        doNotStrip '*/armeabi-v7a/*.so'
        doNotStrip '*/arm64-v8a/*.so'
        jniLibs {
            useLegacyPackaging true
        }
    }
}




// Dependencies for "com.unity.purchasing". This section is automatically generated.
afterEvaluate {
    dependencies {
        implementation 'com.android.billingclient:billing:6.2.1'
    }
}
// End of dependencies for "com.unity.purchasing".

Currently tested 2021.3.43f1 and 2022.3.45f1. Both same. Google doesn’t allow me to upload app bundle with this:

Update your com.google.android.play:core:1.10.3 Maven dependency to an Android 14 compatible version! Your current com.google.android.play:core:1.10.3 library is incompatible with targetSdkVersion 34 (Android 14), which introduces a backwards-incompatible change to broadcast receivers. As a reminder, from August 31, 2024, Google Play requires all new app releases to target Android 14. Update to the latest library version dependency to avoid app crashes.

I tried manually installing Play Core from here https://developers.google.com/unity/packages#play_core

And I tried force resolve, but now the build fails with a duplicated classes error. Still play.core is 1.10.13.

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

@Lazzu
Copy link

Lazzu commented Sep 19, 2024

I am having this same issue with a small difference. Other libraries are already requiring target API 34 which does not change the behaviour as it does in the original description. Nothing changes even if I change the target to 35. I am always getting this error message on multiple devices. AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.Games

@rico345100
Copy link
Author

I am having this same issue with a small difference. Other libraries are already requiring target API 34 which does not change the behaviour as it does in the original description. Nothing changes even if I change the target to 35. I am always getting this error message on multiple devices. AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.Games

Try force resolve or uncheck custom gradle files and check it again.

@Lazzu
Copy link

Lazzu commented Sep 19, 2024

Try force resolve or uncheck custom gradle files and check it again.

Hello, thanks for the input. I have tried force resolving as well as resetting the custom gradle files. The external dependency manager wants to re-enable those as it is required by other plugins.

@rico345100
Copy link
Author

Try force resolve or uncheck custom gradle files and check it again.

Hello, thanks for the input. I have tried force resolving as well as resetting the custom gradle files. The external dependency manager wants to re-enable those as it is required by other plugins.

Yes for some reason EDM4U requires enable custom gradle files. If it asks just press check. Deleting gradle files in android plugin folder and try re-enabling custom gradle files again.

@Lazzu
Copy link

Lazzu commented Sep 20, 2024

If I disable custom gradle files the build fails because of duplicate classes:

 * What went wrong:
[error]  Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
 > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
    > Duplicate class android.support.v4.app.RemoteActionCompatParcelizer found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
      Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
      Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
      Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
      Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
      Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
      Duplicate class androidx.activity.Cancellable found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.activity.ComponentActivity found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.activity.ComponentActivity$1 found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.activity.ComponentActivity$2 found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.activity.ComponentActivity$3 found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.activity.ComponentActivity$NonConfigurationInstances found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.activity.ImmLeaksCleaner found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.activity.OnBackPressedCallback found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.activity.OnBackPressedDispatcher found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.activity.OnBackPressedDispatcher$LifecycleOnBackPressedCancellable found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.activity.OnBackPressedDispatcher$OnBackPressedCancellable found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.activity.OnBackPressedDispatcherOwner found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
      Duplicate class androidx.arch.core.executor.ArchTaskExecutor found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
      Duplicate class androidx.arch.core.executor.ArchTaskExecutor$1 found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
      Duplicate class androidx.arch.core.executor.ArchTaskExecutor$2 found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
      Duplicate class androidx.arch.core.executor.DefaultTaskExecutor found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
      Duplicate class androidx.arch.core.executor.DefaultTaskExecutor$1 found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
      Duplicate class androidx.arch.core.executor.TaskExecutor found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
      Duplicate class androidx.arch.core.internal.FastSafeIterableMap found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
      Duplicate class androidx.arch.core.internal.SafeIterableMap found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
      Duplicate class androidx.arch.core.internal.SafeIterableMap$AscendingIterator found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
      Duplicate class androidx.arch.core.internal.SafeIterableMap$DescendingIterator found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
      Duplicate class androidx.arch.core.internal.SafeIterableMap$Entry found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
      Duplicate class androidx.arch.core.internal.SafeIterableMap$IteratorWithAdditions found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
      Duplicate class androidx.arch.core.internal.SafeIterableMap$ListIterator found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
(...Truncated...)

Interestingly, this happens too if I disable Jetifier in the external dependency manager settings and do a force resolve after deleting the resolved libraries. Another interesting note is that this duplicate class failure shows up in Unity Cloud Build as well, preventing us using it, which is why I'm even doing a build locally.

@hippogamesunity
Copy link

hippogamesunity commented Sep 21, 2024

The same issue with 0.10.14 and Resolver v183, target API 33
java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment
09-21 22:35:43.466 8046 8138 W Unity : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()

I had to update IAP and Resolver because it's required by Google. Still can target API 34 (crash).

@AndrewXeroudakis
Copy link

I have the same issue: I get an error when Social.ShowLeaderboardUI() is called: AndroidJavaException: java.lang.ClassNotFoundException:com.google.games.bridge.HelperFragment. Did anyone fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants