I JUST found the solution to this issue, but given my 2 straight days of troubleshooting and lack of answers online, I am posting this as a record for anybody else with the same problem.
I was trying to implement In-App Reviews for Android and kept getting the following error:
My Error: java.lang.ClassNotFoundException: com.google.android.play.core.review.ReviewManagerFactory
This error was fixed once I deleted Unity’s Advertisement Legacy Package.
Once I redownloaded the Advertisement Legacy Package, the error began popping up again.
Now below was my initial error write-up (if helpful).
I am trying to implement In-App Reviews for Android.
Error: java.lang.ClassNotFoundException: com.google.android.play.core.review.ReviewManagerFactory
This keeps occuring trying to implement In-App Reviews for Android in Unity. I have been troubleshooting for 2 days and have exhausted all possible solutions I could find.
Any guidance would be great appreciated as I am out of rabbit holes to chase down.
Testing Notes:
- Unity Version: 2021.3.15f1(Silicon, LTS).
- Device Tested On: Pixel 2 (Android Version 11)
- Testing Environments: Google Play Closed Testing. Google Player Internal Testing.
- Minify: Not being used
Troubleshooting Attempts:
- Downloaded Unity com.google.play.review (1.8.1) directly.
- Tested older packages (1.7.0). Same error
- Downloaded all .tgz packages seperately. Same error.
- Set Custom Proguard file with these rules referenced from this Github Thread on missing class com.google.android.play.core.review.b. Same error.
- Added Proguard references to the “proguard-unity.txt” to ensure Proguard rules were being brought in from the com.google.play.core and com.google.play.review libraries.
- Built a Custom Gradle to ensure implementation of Play.Core and Play.Review libraries.
- Tried a different Google account.
- Various combinations of all the above.
Logcat Error:
04-20 09:22:22.785 9773 9795 E Unity : AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.play.core.review.ReviewManagerFactory
04-20 09:22:22.785 9773 9795 E Unity : java.lang.ClassNotFoundException: com.google.android.play.core.review.ReviewManagerFactory
04-20 09:22:22.785 9773 9795 E Unity : at java.lang.Class.classForName(Native Method)
04-20 09:22:22.785 9773 9795 E Unity : at java.lang.Class.forName(Class.java:454)
04-20 09:22:22.785 9773 9795 E Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
04-20 09:22:22.785 9773 9795 E Unity : at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
04-20 09:22:22.785 9773 9795 E Unity : at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
04-20 09:22:22.785 9773 9795 E Unity : at android.os.Handler.dispatchMessage(Handler.java:102)
04-20 09:22:22.785 9773 9795 E Unity : at android.os.Looper.loop(Looper.java:223)
04-20 09:22:22.785 9773 9795 E Unity : at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
04-20 09:22:22.785 9773 9795 E Unity : Caused by: java.lang.ClassNotFoundException: com.google.android.play.core.review.ReviewManagerFactory
04-20 09:22:22.785 9773 9795 E Unity : … 8 more
04-20 09:22:22.785 9773 9795 E Unity : at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
04-20 09:22:22.785 9773 9795 E Unity : at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
04-20 09:22:22.785 9773 9795 E Unity : at UnityEngine.AndroidJavaClass._And