Problem building android app with jenkins

Hello
i have a problem building an android app with jenkins.
All the tasks runs ok on the cloned repo, but when I try to build the app with jenkins I get always task not found. the app is a sample app built with android studio wizard.
build gradle in the root

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = ‘1.3.50’
repositories {
google()
jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.5.2'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects {

repositories {
    google()
    jcenter()

}

}

build gradle in app:
apply plugin: ‘com.android.application’

apply plugin: ‘kotlin-android’

apply plugin: ‘kotlin-android-extensions’

android {
compileSdkVersion 29
buildToolsVersion “29.0.1”
defaultConfig {
applicationId “com.example.myapplication”
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName “1.0”
testInstrumentationRunner “androidx.test.runner.AndroidJUnitRunner”
}
buildTypes {
debug{
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android-optimize.txt’), ‘proguard-rules.pro’
}
}
}

Jenkis file is here:
https://pastebin.com/TbW9xWFQ

Error I got is
Task ‘compileDebugSources’ not found in root project ‘My Application’.

Don’t know what to do.

Cheers

In case someone runs into the same issue:
https://pastebin.com/1S8pvULZ

I had to add at every step the env variable pointing to the Android SDK

stage(‘Compile’) {
environment {
ANDROID_HOME="/usr/lib/android-sdk/"

  }

}