How to keep AdColony with Proguard in Unity?

619 views Asked by At

I'm using Proguard and R8 minify on my Unity Game in order to handle Admob Mediation. I integrated AdColony into the game, but during runtime on device it seems that AdColony is removed in the cleanup before the APK is made.

I am unsure what keep line I need to add to my proguard-user file in order to make AdColony work. Does anyone know?

For example, the following example is from a line which is supposed to set GDPR settings for AdColony:

2020/12/17 17:05:02.861 9593 9661 Error Unity AndroidJavaException: java.lang.NoSuchMethodError: no non-static method with name='setGDPRRequired' signature='(Z)Ljava/lang/Object;' in class Ljava.lang.Object;

Thanks in advance!

1

There are 1 answers

0
Clicksurfer On BEST ANSWER

I managed to find the answer myself, so first I'll say what needed to be added, and then how I figured out what to add.

The fix for me was to add the following line to my proguard-user.txt file:

-keep class com.adcolony.sdk.** { *; }

From what I saw, in my Unity project under Assets/Plugins/Android, I had a bunch of packages, one of them named com.adcolony.sdk-4.3.0. Because the naming convention seemed to match the files which usually appear in the proguard file, I tried adding the aforementioned keep line to my file, and it worked!

I will say that I know almost nothing when it comes to proguard. If this was a mere coincidence and the file I kept using that command for not coming from the package I found in the Android directory, please comment down below so I and whoever discovers this in the future will be better informed.