0
\$\begingroup\$

When I build normally my android app it execute without no problems, but when I go to File -> Buil and Run and I eneble Development Build and Autoconnect to profiler I got this error

CommandInvokationFailure: Gradle build failed.
C:/Program Files/Unity/Hub/Editor/2019.1.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/OpenJDK/Windows\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2018.4.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"

stderr[

   FAILURE: Build failed with an exception.

   * What went wrong:
   Execution failed for task ':checkDebugDuplicateClasses'.
   > 1 exception was raised by workers:
   java.lang.RuntimeException: Duplicate class bitter.jnibridge.JNIBridge found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class bitter.jnibridge.JNIBridge$a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.Camera2Wrapper found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.GoogleARCoreApi found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.GoogleVrApi found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.GoogleVrProxy found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.GoogleVrProxy$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.GoogleVrProxy$2 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.GoogleVrProxy$3 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.GoogleVrProxy$4 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.GoogleVrProxy$a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.GoogleVrVideo found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.GoogleVrVideo$GoogleVrVideoCallbacks found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.NativeLoader found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.ReflectionHelper found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.ReflectionHelper$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.ReflectionHelper$a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$10 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$11 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$12 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$13 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$14 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$15 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$16 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$17 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$18 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$19 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$2 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$20 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$21 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$22 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$23 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$3 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$4 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$5 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$6 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$7 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$8 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$9 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$b found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$c found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$d found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$e found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$e$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$e$2 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayer$f found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityPlayerActivity found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityWebRequest found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityWebRequest$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.UnityWebRequest$2 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.a$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.a$2 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.a$3 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.a$4 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.a$5 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.a$a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.b found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.b$a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.b$b found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.c found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.c$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.d found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.e found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.f found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.g found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.h found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.i found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.j found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.k found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.k$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.k$2 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.k$3 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.l found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.l$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.l$a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.m found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.n found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.o found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.o$a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.p found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.p$a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.p$b found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.q found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.q$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.q$1$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.q$1$1$1 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.q$2 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.q$3 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.q$4 found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class com.unity3d.player.q$a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class org.fmod.FMODAudioDevice found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)
   Duplicate class org.fmod.a found in modules classes-2.jar (:openix-release:) and unity-classes.jar (unity-classes.jar)

   Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.


 * Try:
 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

 * Get more help at https://help.gradle.org

 BUILD FAILED in 21s
 ]
 stdout[
      > Task :preBuild UP-TO-DATE
      > Task :preDebugBuild
      > Task :compileDebugAidl NO-SOURCE
      > Task :compileDebugRenderscript NO-SOURCE
      > Task :checkDebugManifest
      > Task :generateDebugBuildConfig
      > Task :prepareLintJar UP-TO-DATE
      > Task :generateDebugSources
      > Task :javaPreCompileDebug
      > Task :mainApkListPersistenceDebug
      > Task :generateDebugResValues
      > Task :generateDebugResources
      > Task :mergeDebugResources
      > Task :createDebugCompatibleScreenManifests
      > Task :processDebugManifest
      > Task :processDebugResources
      > Task :compileDebugJavaWithJavac
      > Task :compileDebugSources
      > Task :mergeDebugShaders
      > Task :compileDebugShaders
      > Task :generateDebugAssets
      > Task :mergeDebugAssets
      > Task :validateSigningDebug
      > Task :signingConfigWriterDebug
      > Task :checkDebugDuplicateClasses FAILED

      Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
      Use '--warning-mode all' to show the individual deprecation warnings.
      See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings 18 actionable tasks: 17 executed, 1 up-to-date
                ]
      exit code: 1
      UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
      UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
      vUnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
      UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
      UnityEditor.Android.GradleWrapper.Run (Unit<message truncated>`

I'm using Unity 2018.4.4.f1 and in my project I have an *.aar file that I made using Android Studio

I would appreciate any help you can give

\$\endgroup\$
1
\$\begingroup\$

You are using a plugin, either a .aar or .jar, that is compiled with the UnityPlayer.jar (or classes.jar) file. Both classes.jar are compiled in your final build, so it throws a duplicate class exception.

To avoid this, try to add on your plugin module gradle, on the dependencies config, the following:

compileOnly files('./libs/classes.jar') // Avoid redundant Unity Player in final application APK

So your .gradle looks like:

//...
dependencies {
    //...

    compileOnly files('./libs/classes.jar') // Avoid redundant Unity Player in final application APK
    ///...
}
//...
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.