PTCInc / vuforia-engine

Bug and feedback issue tracker for the Vuforia Engine SDK
https://developer.vuforia.com
19 stars 0 forks source link

Duplicate Class error when building for Android with Firebase #86

Closed josefgrunig closed 4 months ago

josefgrunig commented 5 months ago

Summarize the bug: I get a lot of Duplicate Class errors when building for Android Platform with Unity 2022.3.16f1 and Firebase 11.6.0

Observed problem Build fails with Duplicate Class errors. Pasting here only part of the error list:

Duplicate class androidx.annotation.AnimRes found in modules androidx.annotation.annotation-1.5.0 (androidx.annotation.annotation-1.5.0.jar) and annotation-1.3.0 (androidx.annotation:annotation:1.3.0)
     Duplicate class androidx.annotation.AnimatorRes found in modules androidx.annotation.annotation-1.5.0 (androidx.annotation.annotation-1.5.0.jar) and annotation-1.3.0 (androidx.annotation:annotation:1.3.0)
     Duplicate class androidx.annotation.AnyRes found in modules androidx.annotation.annotation-1.5.0 (androidx.annotation.annotation-1.5.0.jar) and annotation-1.3.0 (androidx.annotation:annotation:1.3.0)
     Duplicate class androidx.annotation.AnyThread found in modules androidx.annotation.annotation-1.5.0 (androidx.annotation.annotation-1.5.0.jar) and annotation-1.3.0 (androidx.annotation:annotation:1.3.0)
     Duplicate class androidx.annotation.ArrayRes found in modules androidx.annotation.annotation-1.5.0 (androidx.annotation.annotation-1.5.0.jar) and annotation-1.3.0 (androidx.annotation:annotation:1.3.0)
     Duplicate class androidx.annotation.AttrRes found in modules androidx.annotation.annotation-1.5.0 (androidx.annotation.annotation-1.5.0.jar) and annotation-1.3.0 (androidx.annotation:annotation:1.3.0)
     Duplicate class androidx.annotation.BinderThread found in modules androidx.annotation.annotation-1.5.0 (androidx.annotation.annotation-1.5.0.jar) and annotation-1.3.0 (androidx.annotation:annotation:1.3.0)

Expected result I expect it to build an APK

Reproducible steps Steps to reproduce the behavior:

  1. Open Vuforia Sample Project. I am building only the "3-ImageTargets" Scene
  2. Install Vuforia 10.20.3
  3. Integrate FirebaseAnalytics (https://firebase.google.com/download/unity)
  4. Build, after Resolver has run.

Affected Vuforia Engine version: v10.20.3

Affected platform:

Workaround Works with older Vuforia version 10.10.2

ptc-thesbyro commented 4 months ago

Hello,

I can confirm that I can reproduce the same errors with the 11.6.0 FirebaseAnalytics.unitypackage and the Core Samples 10.20.3. Though, I am not sure this is caused by the Vuforia Engine Core Samples. It seems to be a Unity/Gradle problem that can be solved by enabling the templates in PlayerSettings->Android->Publish Settings, for:

And then build the project.

See also https://forum.unity.com/threads/help-me-solve-the-problem.1467434/ where the solution was posted.

Hope it helps,

ptc-pscheper commented 4 months ago

This issue is closed due to inactivity. Feel free to re-open or create a new bug report in the future.

josefgrunig commented 4 months ago

Hi @ptc-pscheper, let me add some more info: after enabling the three custom templates from the Settings, remember to delete the Resolved libraries (Assets->External Dependency Manager->Android Resolver->Delete Resolved Libraries) and the Force a Resolve again form same menu. Without this step, it won't work. Thank you.