-
What’s on your mind?
-
I can’t use with Unity Games Services (IAP)
-
Are there any instructions that help me solve duplicate class in unity project
-
-
Optional: if i use only web3auth it’s working perfectly.
-
Optional: i try to solve with this file and delete old .arr , it’s can build but can not open app.
Thanks — I’m sorry you’re hitting this, Rattanachai. You’ve given a good start. This looks like a duplicate Android library (.aar) / duplicate-class conflict in a Unity Android build (likely when combining MetaMask/Web3Auth libraries with Unity Game Services IAP). I’ll summarize what I see, what I need, and some targeted steps you can try right away.
Summary of what I found
- Reported platform: Unity (Android build) — duplicate .arr (likely .aar) / duplicate class error when using Unity Game Services IAP
- Works when you use only Web3Auth (so the conflict is between SDKs/libraries included together)
- You deleted an old .aar and then the build produced an app that won’t open (suggests a missing dependency or manifest/Gradle merge issue)
What I need if you want deeper help (please only share what you can):
- Exact Unity version and Android build system (Gradle/Internal). (This matters for resolver behavior.)
- Exact error text or full Unity Console / Gradle build log (the duplicate-class name and the two .aar paths that contain it). A screenshot of the Unity Console/Editor/Gradle log is fine.
- A list (or screenshot) of files in Assets/Plugins/Android (the .aar files). That helps identify which libraries provide the duplicate classes.
- Versions of the SDKs involved: MetaMask SDK (if used), Web3Auth version, Unity Game Services IAP version. If you don’t know exact versions, the filenames of the .aar often contain them.
- Whether you use External Dependency Manager (a.k.a. Play Services Resolver / EDM4U) and whether you’ve run Resolve/Force Resolve.
Likely cause (short):
- Two different packages include the same Java class files (duplicate classes inside different .aar files). Deleting a package manually can let the project build but then cause the app to crash at runtime because you removed required code or broke an AndroidManifest/Gradle dependency.
Immediate fixes to try
- Don’t manually delete without checking dependency graph: restore the project or the removed .aar so we can inspect conflicts.
- Use External Dependency Manager (EDM4U) to resolve Android dependencies instead of manual deletion:
- If not installed: get External Dependency Manager for Unity (GitHub - googlesamples/unity-jar-resolver: Unity plugin which resolves Android & iOS dependencies and performs version management or Unity-Technologies/ExternalDependencyManager).
- Then use Assets > External Dependency Manager > Android Resolver > Force Resolve. This will merge duplicate transitive deps or pick one version.
- Inspect Assets/Plugins/Android for duplicate .aar files. If two .aar expose the same classes, remove the redundant one ONLY if you confirm it’s not required by another SDK.
- Check the Gradle build log (open the Editor log or build output) to find the exact duplicate class name and the two module paths. The error lines look like: Duplicate class com.example.SomeClass found in modules (…)
- If the conflict is from commonly-shaded libs (okhttp, guava, org.json, gson), prefer the version required by the SDK you need and exclude the other copy. With custom Gradle templates (mainTemplate.gradle) you can add packagingOptions or exclude rules, but duplicate class errors usually require removing/merging the .aar rather than just excluding files.
- If after resolving duplicates the app builds but won’t open, check logcat for runtime exceptions (ClassNotFoundException, NoSuchMethodError, manifest merge problems). Share that log and I can help diagnose.
Helpful links
- MetaMask docs: https://docs.metamask.io
- External Dependency Manager for Unity (resolver): GitHub - googlesamples/unity-jar-resolver: Unity plugin which resolves Android & iOS dependencies and performs version management and https://github.com/Unity-Technologies/ExternalDependencyManager
- Unity docs on Android plugins/gradle: https://docs.unity3d.com/Manual/android-plugins.html and Unity - Manual: Gradle for Android
If you’d like, next steps you can paste here (or attach):
- The Unity Console/Gradle duplicate-class error text or screenshot (this is the most useful)
- A folder listing or screenshot of Assets/Plugins/Android (.aar files)
- Unity version and build system (Gradle/Internal) and the IAP/Web3Auth/MetaMask SDK versions
I’ll keep watching this thread and can propose exact removals or Gradle rules once I see the duplicate-class names and which .aar files contain them. You’re close — these conflicts are common and usually resolved via the Android Resolver or by removing a redundant .aar safely.
Note: This response was generated by an AI bot and may require further verification. The MetaMask Community Team has tracked this issue and will be responding as soon as possible.
Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. MetaMask Developer Office Hours
This is all information i gather.
- Unity 6.3 and 2022.3 both face same issue with Gradle build
- Screenshot of Console (the duplicate-class)
-
A list of files: Assets/Plugins/Android
-
A list of files: Assets/Plugins/Web3AuthSDK
-
Web3Auth SDK Version 5.0.0 - unity package
-
EDM4U 1.2.185
-
Unity IAP 5.1.2
-
Android Resolver Setting
I don’t know much about how to use Resolver.






