Fix Google Play’s In-App Review not working with Minify in Unity
If your in-app review doesn’t show up and tick all the below checks:-
1. You followed the Google Play’s official documentation on integrating their in-app review in your Unity game/app.
2. Have Minify > Release
enabled under Publishing Settings of Unity.
3. The build has been uploaded to Internal Test Track or Play Internal App Sharing.
Then you might have to generate a custom Proguard file.
Google Play’s in-app review feature allows developers to prompt users to leave reviews directly within their app. However, there have been instances where this feature fails to work properly when the Minify option is enabled under the Publishing Settings of Unity. In this article, we will discuss the steps to ensure that the in-app review functionality works correctly even when Minify is enabled.
Edit > Project Settings > Player > Android icon > Publishing Settings > Minify
Before we proceed, it’s essential to understand that enabling Minify in Unity’s Publishing Settings helps optimise and reduce the size of your Android application by removing unused code. However, this optimisation process can sometimes interfere with certain features, such as the in-app review.
Curious to know how I zeroed down the issue was caused due to Minify?
I’ve mentioned here.
To resolve the issue, follow the below steps:
1.Enable custom Proguard file in Unity
Navigate to Project Settings > Player > Publish Settings
and enable the Custom Proguard File
option.
By using a custom Proguard file, we make sure the classes necessary for functioning of in-app review is always included in the build.
Project Settings > Player > Publish Settings >
Custom Proguard File
2. Modify the Proguard Configuration
Unity creates a new file called “proguard-user.txt” underAssets > Plugins > Android
Assets > Plugins > Android > proguard-user.txt
Open this newly created file and paste the following code into it:
# Copyright 2019 Google LLC
#
# The Google Play Core Library is licensed to you under the Play Core Software
# Development Kit Terms of Service
# (https://developer.android.com/guide/playcore/license.html).
# By using the Google Play Core Library, you agree to the Play Core Software
# Development Kit Terms of Service.
# Play Core Proguard Rules: Play In-app Review
-keep class com.google.android.play.core.review.ReviewManager {
public com.google.android.gms.tasks.Task requestReviewFlow();
public com.google.android.gms.tasks.Task launchReviewFlow(android.app.Activity, com.google.android.play.core.review.ReviewInfo);
}
-keepnames class com.google.android.play.core.review.ReviewInfo
-keep class com.google.android.play.core.review.ReviewManagerFactory {
<init>();
public static com.google.android.play.core.review.ReviewManager create(android.content.Context);
}
-keep class com.google.android.play.core.review.testing.FakeReviewManager {
public <init>(android.content.Context);
public com.google.android.gms.tasks.Task requestReviewFlow();
public com.google.android.gms.tasks.Task launchReviewFlow(android.app.Activity, com.google.android.play.core.review.ReviewInfo);
}
-keep class com.google.android.play.core.review.model.ReviewErrorCode {
public static int NO_ERROR;
public static int PLAY_STORE_NOT_FOUND;
public static int INVALID_REQUEST;
public static int INTERNAL_ERROR;
}
-keep class com.google.android.play.core.review.ReviewException {
public int getErrorCode();
}
# Fixes Tasks class not found error
-keep class com.google.android.gms.tasks.** { *; }
These lines have been been directly copied from the file,Asset > GooglePlayPlugins > com.google.play.review > Proguard > review.txt
Except the last line which has been added based on the logs from logcat.
Read my article to further know how to figure out which classes to add in the custom Proguard file.
3. Force Resolve Dependencies
To ensure the proper resolution of dependencies, use the Android Resolver tool. Go toAssets > External Dependency Manager > Android Resolver > Force Resolve
Assets > External Dependency Manager > Android Resolver > Force Resolve
4. Upload to Internal Test Track or Play Internal App Sharing
of your Play Developer Console. These options allow you to distribute your app to a limited audience for testing purposes.
Note: Play Internal App Sharing is preferred as there are no additional checks/reviews performed by Google Play. After uploading your app bundle, wait 2–7 minutes for it to be available for installation via the unique link.
5. Verify Account in Play Store App before opening the game
Ensure that the Google Play Store app is signed in with the account associated with the Testers list in the Play Console. Failure to do so may prevent the review pop-up from appearing.
Note: The in-app review pop up doesn’t allow you to submit the review if the game/app has been installed from the Play Internal App Sharing.
I hope this article helps you resolve the issue with Google Play’s in-app review functionality and enables you to gather valuable user feedback seamlessly within your Unity game/app.
If not, at least I hope it points you in a direction where you can further research upon the possible fixes.