"Duplicate class (...) found in modules" Error while making Build for Android

What went wrong

Execution failed for task launchercheckDebugDuplicateClasses
1 exception was raised by workers:
java Jang RuntimeException: java.lang RuntimeException: Duplicate class com.android billingclient BuildConfig found in modules jetified-billing 4.0.0-runtime jar (billing 4.0.0) and jetified.com.android billingclient.billing 6.1.0-runtime.jar [com.android.billingclient.hilling: 6.1.0.

Do you use Applovin and get this error when building?
I think it’s caused by the myTarget network. When I updated myTarget to version android_5.20.0.0_ios_5.20.1.0 I got this error. If I go back to version android_5.19.0.0_ios_5.19.0.0, the problem will no longer occur. You can use an older version or try uninstalling myTarget. Hope this can help you.