Search Unity

Gradle Build Error

Discussion in 'AR' started by tpaslou, Mar 30, 2018.

  1. tpaslou

    tpaslou

    Joined:
    Mar 30, 2018
    Posts:
    10
    Hello
    I m trying to build my ARCore HelloAR and i m getting build error

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

    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 Lcom/google/android/aidl/BaseProxy;

    I 've done a bit of research but i didnt really get any solution.I ve downgraded sdk to v24 and my JDK is v8
     
  2. reedny

    reedny

    Joined:
    Mar 4, 2017
    Posts:
    57
    Do you also have Daydream GVR or Cardboard packages in your project. I saw the same error also with GVR.

    This is because there is a Java package (com.google.android.aidl.BaseProxy) that is in both ARCore and another package you are using. I had the same issue with ARCore and GVR. You need to remove the package from one of the aar files. I chose arcore_client.aar from ARCore. And then (there must be an easier way to do this) :
    1. rename arcore_client.aar to arcore_client.zip
    2. look at arcore_client.zip in Windows explorer and find the classes.jar file inside.
    3. Copy classes.jar out of the zip
    4. Rename classes.jar to classes.zip
    5. Look inside classes.zip in Windows explorer for the above package and delete the .class files (I had 3 of them)
    6. Rename classes.zip to classes.jar
    7. Copy back into arclient_core.zip
    8. Rename arclient_core.zip to arclient_core.aar
    9. Copy back to the ARCore asset folder where you found it.
    10. That should give you a working build
     
    tpaslou likes this.
  3. tpaslou

    tpaslou

    Joined:
    Mar 30, 2018
    Posts:
    10
    You were completely right !
    Thank you so much.I didnt notice i was using Cardboard packages.I had them enabled in my Player VR build Settings and i disabled them cause for the time being i dont need it.But in future builds of my project there is a high possibility that i use cardboard support so i ll know how to solve it