'assembleDebug' Task not Found While Running From Jenkins
Solution 1
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
Solution 2
I fixed the "task 'assembleDebug' not found in root project" error by adding an ANDROID_HOME environment variable
Solution 3
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
Solution 4
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.
tarunsh_iphone
Updated on July 05, 2022Comments
-
tarunsh_iphone almost 2 years
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.
-
tarunsh_iphone about 6 yearsAppreciate your help sanemars! I don't have access to my build machine, I will try it and update it. One thing I need to clear, the inner gradle file (PopularMovies/SourceCode/app/build.gradle) content to be replaced in outer gradle file as well. Am I correct ?
-
sanemars about 6 yearsyou can declare variable in project gradle and use it in module gradle.project gradle can not directly replace module gradle content.
-
tarunsh_iphone about 6 yearsThanks again for the help sanemars, yup that worked for me. I made the change in project structure and keep the gradle file at root of project itself.
-
solamour over 4 years
ANDROID_HOME
was the answer for me. Specifically, Jenkins -> Manage Jenkins -> Configure System -> Environment variables -> Name: ANDROID_HOME, Value: Android SDK directory -
Naman Jain over 2 yearsAnd how to do this
-
Fernando Aureliano about 2 yearsWich file I should edit to make this change? Thanks!