Android Build Fails on specific runner; gradle build works fine locally....

Hello,

I am a newbie for the Continuous Integration. I have tried to build my android project using different .gitlab-ci.yml configuration. But every time it just fails I want to trace what causes the build failure, but how?

Here is the cod I have in .gitlab-ci.yml

# from : http://www.greysonparrelli.com/post/setting-up-android-builds-in-gitlab-ci-using-shared-runners/
#before_script:
#  - export ANDROID_HOME="/home/demo/project/android/android_sdk"
#
#dev:
#  script:
#    - ./gradlew assembleDebug

# from : https://mdxdave.de/android/android-gitlab-runner @2016-11-21 01:25
#before_script:
#    - chmod +x gradlew
#build:
#  script:
#    - ./gradlew build
#  tags:
#    - android


#from: https://github.com/jangrewe/gitlab-ci-android/blob/master/.gitlab-ci.yml

image: registry.magic-technik.de/gitlab-ci/android

stages:
- build

before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew

cache:
  key: ${CI_PROJECT_ID}
  paths:
  - .gradle/

build:
  stage: build
  script:
  - ./gradlew assembleDebug
  artifacts:
    paths:
    - app/build/outputs/apk/app-debug.apk

And here is my build.gradle form main module of the project:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '24.0.3'
    defaultConfig {
        applicationId "com.package.app"
        minSdkVersion 19
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:support-annotations:24.2.1'
    compile 'com.android.support:support-vector-drawable:24.2.1'
    compile 'com.android.support:design:24.2.1'
}

Am I missing anything? Or I got the concept in wrong way?

Thanks in advance !!!