Building an Android multidex application using gradle without Android Studio (on a build server)
<p>I'm in the process of setting up a CI server running TeamCity.</p>

<p>The server is running openjdk8, I'm using build tools 23.0.2</p>

<p>I have a multidex Android app that I am able to build locally using assembleMyFlavorRelease. This same build fails on my TeamCity agent on <code>app:transformClassesWithDexForMyFlavorRelease</code></p>

<p>The stacktrace shows <code>java</code> exiting with 1 though I can't seem to find why</p>

<pre><code>[Gradle failure report] Execution failed for task ':app:transformClassesWithDexForMyFlavorRelease'.
[Gradle failure report] &gt;
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException: 
org.gradle.process.internal.ExecException: 
Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 1

Exception is:
[Gradle failure report] org.gradle.api.tasks.TaskExecutionException:
Execution failed for task ':app:transformClassesWithDexForMyFlavorRelease'.
....
Caused by: 
java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 1
....
Caused by: 
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 1
</code></pre>

<p>My app.gradle looks like this</p>

<pre><code>productFlavors {

    final def MIN_SDK = 19
    final def TARGET_SDK = 23

    myFlavor {
        minSdkVersion MIN_SDK
        targetSdkVersion TARGET_SDK
        multiDexEnabled true
    }
</code></pre>

<p>With these dex options</p>

<pre><code>dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries false
 }
</code></pre>

<p>Compiling with</p>

<pre><code>compileSdkVersion 23
buildToolsVersion '23.0.2'
</code></pre>

<p>using multidex 1.0.1</p>

<pre><code>dependencies {
  compile 'com.android.support:multidex:1.0.1'
}
</code></pre>

<p>The build agent completes both</p>

<pre><code>:app:collectMyFlavorReleaseMultiDexComponents
:app:transformClassesWithMultidexlistForMyFlavorRelease
</code></pre>

<p>Before failing on </p>

<pre><code>app:transformClassesWithDexForMyFlavorRelease
</code></pre>

<p>Running with info reveals this before exiting</p>

<pre><code>[org.gradle.launcher.daemon.client.DaemonClient] Received result Failure[value=org.gradle.initialization.ReportedException:
org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':app:transformClassesWithDexForMyFlavor'.] 
from daemon DaemonInfo{pid=2200, 
address=[a10b64d0-94c0-40e9-8b5d-b5a5bbb171c4 port:46291, addresses:[/0:0:0:0:0:0:0:1%lo, /127.0.0.1]], idle=false,
context=DefaultDaemonContext[uid=968a9ee5-e6d4-4cba-a2a5-ce768ecbfe44,
javaHome=/usr/lib/jvm/java-8-openjdk-amd64,
daemonRegistryDir=/root/.gradle/daemon,pid=2200,idleTimeout=120000,
daemonOpts=-XX:MaxPermSize=512m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx2048m,-Dfile.encoding=UTF-8,
-Duser.country=US,-Duser.language=en,-Duser.variant]
</code></pre>

<p>Any help or direction at this point would be greatly appreciated! </p>