Jenkins -AAPT2 - Daemon startup failed

167 views Asked by At

I'm currently working on automating the APK build process, setting up a Jenkins pipeline for the project. My Jenkins is on a Docker container that has npm, Ionic, OpenJDK, Android SDK, and Gradle installed. Our team is using Capacitor in the project. This is my "Build APK" stage in my pipeline

 stage('Build APK') {
         sh 'npm run build'
         sh 'npx capacitor sync android'
         sh 'npx capacitor build android --keystorepath /keyfiles/<filename>.jks --keystorealias <alias> --keystorepass <pass> --keystorealiaspass <pass> --androidreleasetype APK'

However, I'm encountering an error in the Jenkins console:

        > Task :app:mergeReleaseResources FAILED
        > Task :capacitor-google-maps:extractReleaseAnnotations
        
        FAILURE: Build failed with an exception.
        
        * What went wrong:
        Execution failed for task ':app:mergeReleaseResources'.
        > Multiple task action failures occurred:
        > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
        > AAPT2 aapt2-7.2.1-7984345-linux Daemon #0: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
        > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
        > AAPT2 aapt2-7.2.1-7984345-linux Daemon #2: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
        > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
        > AAPT2 aapt2-7.2.1-7984345-linux Daemon #1: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.

Tried searching on google and stackoverflow, but still issue exists.

1

There are 1 answers

0
Utkarsh On BEST ANSWER

I resolved this issue by switching to a different base image of Jenkins. I initially used the Alpine image (FROM docker.io/jenkins/jenkins:alpine) and then changed it to the latest version (FROM jenkins/jenkins:latest), which successfully resolved the problem.