Search Unity

CommandInvokationFailure: Gradle build failed when using Unity Ads

Discussion in 'Android' started by Wapeto, Dec 8, 2018.

  1. Wapeto

    Wapeto

    Joined:
    Dec 2, 2018
    Posts:
    4
    I can not build my game anymore since this message apeared when I try to build :


    CommandInvokationFailure: Gradle build failed.
    C:/Program Files/Java/jdk1.8.0_191\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.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 ':transformDexWithDexForRelease'.
    > 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/unity3d/ads/BuildConfig;


    please help fast !
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    You probably have the "Unity ads" library included more than once (possibly - once in the project and another one by checking it under the "Services" tab).
     
  3. Wapeto

    Wapeto

    Joined:
    Dec 2, 2018
    Posts:
    4
    And how can I do that ?
     
  4. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Look for the unityads jar or aar file in your project, and remove it (if indeed you are including unity ads from the "services" tab).
     
  5. Wapeto

    Wapeto

    Joined:
    Dec 2, 2018
    Posts:
    4
    Thank's you so much it's working !