Duplicate class error

How do I resolve “Duplicate class” error during the build?
I’m new to gradle and android development so please try to explain as much as possible.

I’m using Android Studio to add some functionality to a project that is generated in a game development tool.

In the Module:App build.gradle file, AS has added the dependency:

implementation ‘com.android.support:design:28.0.0’

Which is needed to use Snackbar.
But this conflicts with many classes found in the .jar already used in the project com.android.support:support-v4:24.0.0

How do I deal with this?

This might be because of both dependencies using different versions of same classes. Try upgrading support-v4:24.0.0 dependency to a version compatible with design:28.0.0