0

I am using unity3d in my android studio project and need to import the unity ads aar file into my project. To do so I added the following lines and the unity-ads.aar to the libs folder :

    implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
    implementation files('libs/unity-ads.aar')

I get the following error when I compile the project :

Duplicate class com.unity3d.ads.BuildConfig found in modules jetified-unity-ads-4.2.1-runtime (com.unity3d.ads:unity-ads:4.2.1) and jetified-unity-ads-runtime (unity-ads.aar)

If I delete these lines and the unity-ads.aar file all the classes from unity3d aren't recogonized and I get errors.

I don't understand why the classes are duplicated and how I can resolve this issue.

Hooksta93
  • 11
  • 1

1 Answers1

2

You only need the first line implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])

and make sure you update your gradle version to 7.x.x

file -> Project Structure

enter image description here