TitleWhen building an Android project, there is an issue with Google Play Core library conflicts.2024-04-04 17:37:24
Writer

When including the Google Play Core legacy library (com.google.android.play:core) in your game project, a conflict issue (Duplicate class) occurs with the latest Google Play Core libraries (com.google.android.play:review, com.google.android.play:app-update) added as a transitive dependency of the Hive SDK. 


The following settings can make the Hive SDK compatible with the Google Play Core legacy library. 


1. Remove the Google Play Core libraries included in the Hive SDK.

  • Add the following line to the module-level build.gradle file.

android { configurations.all{ exclude group: 'com.google.android.play', module: 'review' // This setting should only be configured for version v4.22.0.0+.

// The default update popup provided by Hive will be displayed.

        exclude group: 'com.google.android.play', module: 'app-update'
    }
} 


2. Additional settings for the R8 (formerly ProGuard) configuration file.

  • To use the R8 compiler for app optimization, add the following content to the R8 configuration file. 

-keep class com.google.android.play.core.review.ReviewManager { *; }
-keep class com.google.android.play.core.review.ReviewManagerFactory { *; }
-keep class com.google.android.play.core.tasks.Task { *; }
-keep class com.google.android.play.core.tasks.OnCompleteListener { *; }