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.
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
I fixed the "task 'assembleDebug' not found in root project" error by adding an ANDROID_HOME environment variable
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With