Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Multiple dex files?

Discussion in 'Android' started by GearVR, May 1, 2018.

  1. GearVR

    GearVR

    Joined:
    Nov 13, 2015
    Posts:
    16
    I'm getting the following exception when building an apk along with an Android plugin I'm making.

    I've simplified the plugin to narrow down causes so that the class is empty like

    public class MyPluginTest extends UnityPlayerActivity
    {}
    And I only copy classes.jar to my Android Studio project's lib folder. (No other jars)

    But I still get the problem. Please help



    CommandInvokationFailure: Gradle build failed.
    C:/Program Files/Java/jdk1.8.0_144\bin\java.exe -classpath "C:\Program Files\Unity 2017.3.0b7\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

    stderr[

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':transformClassesWithDexForRelease'.
    > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lbitter/jnibridge/JNIBridge$a;

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

    BUILD FAILED in 6s
    ]
     
  2. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    marchinram and kiparis87 like this.
  3. plasticYoda

    plasticYoda

    Joined:
    Aug 20, 2013
    Posts:
    62
    For me, the default New Project settings includes all Jar files in the libs folder by default. I had to switch that to 'compileOnly' in my gradle file.
     
  4. nawash

    nawash

    Joined:
    Jan 29, 2010
    Posts:
    166
  5. Vauxvogh

    Vauxvogh

    Joined:
    Nov 29, 2017
    Posts:
    10
    How do you do that?
     
  6. nawash

    nawash

    Joined:
    Jan 29, 2010
    Posts:
    166
    Problem solved days ago: make sure the "implementation" lines are ok and consistent.
     
  7. youblistermypaint

    youblistermypaint

    Joined:
    Aug 5, 2015
    Posts:
    14
    Can you expand on what that means?
     
    neonblitzer likes this.