Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'assembleDebug' Task not Found While Running From Jenkins

I am new to Android development and trying to setup Jenkins to automate build generation on my mac machine. When I run the Jenkins build it is not generating any apk at jenkins workspace. I am gradle wrapper and 'gradlew assembleDebug' command but it give error that " 'assembleDebug' Task not found in root project". I tried 'gradlew tasks' to view all available tasks and it does not list any android specific tasks.

When I open the same project using Android Studio, it listed all tasks properly (including assembleDebug).

What could be potential issue! is it Android sdk path or gradle plugin in Jenkins environment causing this.

Any help is greatly appreciated.

like image 880
tarunsh_iphone Avatar asked Mar 09 '18 06:03

tarunsh_iphone


4 Answers

If you're landing here while searching for this error in Android Studio: This error can also occur if one of the build.gradle files were updated via external means such as GIT. Android Studio may think it's in SYNC even if it isn't. Check that you have the correct build tools for the version you are compiling and then try the solution below:

Try clicking the Sync Project with Gradle Files

like image 104
teynon Avatar answered Oct 09 '22 15:10

teynon


I fixed the "task 'assembleDebug' not found in root project" error by adding an ANDROID_HOME environment variable

like image 39
Eric Nelson Avatar answered Oct 09 '22 15:10

Eric Nelson


change your module Gradle to this

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.tarunsmac.moviesapp"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        debug{
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

and try

like image 4
sanemars Avatar answered Oct 09 '22 14:10

sanemars


Today, I faced this error. I started facing this error when I updated my code with SVN branch. What I did i just invalidate cache/restart Android studio, Everything got back and started working. This fixed in my case.

like image 4
Abdul Waheed Avatar answered Oct 09 '22 15:10

Abdul Waheed