Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
706 views
in Technique[技术] by (71.8m points)

jenkins - Android gradle build script returns error 137 in preDexDebug

I am trying to build an Android project on our Debian build server with gradlew.

Each time I run it the build fails on the preDexDebug step with error 137 and the following error. I tried the stacktrace but this didn't give me any more information, except that it is an unhandled exception. In the console I can see the preDexDebug build step fail at 39%.

:Carpool:preDexDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':Carpool:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
        /opt/android-sdk-linux/build-tools/19.0.3/dx --dex --output /var/lib/jenkins/jobs/Project/workspace/com.app.space/Carpool/build/pre-dexed/debug/classes-c1baba1a2bb3528538a151852945d1f7047c7393.jar /var/lib/jenkins/jobs/Project/workspace/com.app.space/Carpool/build/exploded-aar/com.google.android.gms/play-services/4.0.30/classes.jar
  Error Code:
        137

The build script:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 19
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.android.support:gridlayout-v7:19.1.0'
    compile 'com.android.support:appcompat-v7:19.1.0'
    compile 'com.google.android.gms:play-services:4.0.30'
}

Any ideas on the cause of this problem, workarounds or additional checks I could do?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem was due to memory problems on the build server. Switching to a build server with more memory has fixed the problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...