I have use jenkins with docker
after pull and install the following plugin
Git Plugin
Gradle Plugin
Android Lint Plugin
Google Play Android Publisher Plugin
THEN setup JDK, Repository (GitLab)
AND create project and run, it's show the following error.
RUN COMMAND
docker run -p 8080:8080 -v /Users/abc/Library/Android/sdk:/var/android_home -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts
JENKINS CONSOLE OUTPUT
Building in workspace /var/jenkins_home/workspace/ABC Project
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url http://office.viinsoft.com/issoft/mappening-android.git # timeout=10
Fetching upstream changes from http://office.viinsoft.com/issoft/mappening-android.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress http://office.viinsoft.com/issoft/mappening-android.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 7a760b63852e92c57e5b4dea5bdf6680b01d8894 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 7a760b63852e92c57e5b4dea5bdf6680b01d8894
Commit message: "Test Jenkins#2"
> git rev-list --no-walk 7a760b63852e92c57e5b4dea5bdf6680b01d8894 # timeout=10
[Gradle] - Launching build.
[Mappening Project] $ "/var/jenkins_home/workspace/Mappening Project/gradlew" assembleDebug
Starting a Gradle Daemon (subsequent builds will be faster)
Configuration 'testCompile' in project ':app' is deprecated. Use 'testImplementation' instead.
Configuration 'androidTestCompile' in project ':app' is deprecated. Use 'androidTestImplementation' instead.
:app:preBuild UP-TO-DATE
:app:preDevDebugBuild UP-TO-DATE
:app:compileDevDebugAidl UP-TO-DATE
:app:compileDevDebugRenderscript UP-TO-DATE
:app:checkDevDebugManifest UP-TO-DATE
:app:generateDevDebugBuildConfig UP-TO-DATE
:app:generateDevDebugResValues UP-TO-DATE
:app:generateDevDebugResources UP-TO-DATE
:app:mergeDevDebugResourcesAAPT err(Facade for 849578689): /var/android_home/build-tools/26.0.2/aapt2: 6: /var/android_home/build-tools/26.0.2/aapt2: Syntax error: Unterminated quoted string
AAPT err(Facade for 1702555035): /var/android_home/build-tools/26.0.2/aapt2: 6: /var/android_home/build-tools/26.0.2/aapt2: Syntax error: Unterminated quoted string
Slave 1702555035 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /var/android_home/build-tools/26.0.2/aapt2) are not corrupted.
at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:211)
at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:213)
at java.lang.Thread.run(Thread.java:748)
AAPT err(Facade for 1365735589): /var/android_home/build-tools/26.0.2/aapt2: 6: /var/android_home/build-tools/26.0.2/aapt2: Syntax error: Unterminated quoted string
Slave 1365735589 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /var/android_home/build-tools/26.0.2/aapt2) are not corrupted.
at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:211)
at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:213)
at java.lang.Thread.run(Thread.java:748)
AAPT err(Facade for 212997924): /var/android_home/build-tools/26.0.2/aapt2: 6: /var/android_home/build-tools/26.0.2/aapt2: Syntax error: Unterminated quoted string
Slave 212997924 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /var/android_home/build-tools/26.0.2/aapt2) are not corrupted.
at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:211)
at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:213)
at java.lang.Thread.run(Thread.java:748)
Slave 849578689 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /var/android_home/build-tools/26.0.2/aapt2) are not corrupted.
at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:211)
at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:213)
at java.lang.Thread.run(Thread.java:748)
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
:app:mergeDevDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDevDebugResources'.
> Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
7 actionable tasks: 1 executed, 6 up-to-date
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
TRAIL AND STILL ERROR
I was google around it seem that, a solution need to use older build-tool which I don't want Android studio 2.1.2 gradle aapt Syntax error: Unterminated quoted string
and someone said I have missing library to execute 64 bit code, so I run the following command on my mac OSX and check, but it seem okay Android Studio 3.0 - No server to serve request
otool -L build-tools/26.0.2/aapt2
build-tools/26.0.2/aapt2:
#rpath/libc++.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
finally, I give permission to my local path sudo chmod 755 -R /Users/sattha.p/Library/Android/sdk but nothing change even restart docker.
Related
I am trying to build an apk via jenkins for my android application. I followed this tutorial to do this.The issue I have is my Android sdk is installed in a separate hard disk (Not the one where jenkins is installed).
So the path I set for the sdk in the environment variable is not identified by jenkins & the build fails. But I can build an apk normally using Android studio with the same sdk path.
P.S Android studio is installed in the same hard where jenkins is installed. I referred to this solution but still no luck. Also I cannot move the sdk to the disk where I have installed jenkins because of a disk space issue. Please can any one help me on this ?
Please refer to the console log in Jenkins
16:52:08 Started by user Darrel Rayen
16:52:08 Building in workspace /var/lib/jenkins/workspace/android-
recruiter-app
16:52:08 > git rev-parse --is-inside-work-tree # timeout=10
16:52:08 Fetching changes from the remote Git repository
16:52:08 > git config remote.origin.url
https://DarrelR#bitbucket.org/harver/android-recruiter-app.git #
timeout=10
16:52:08 Fetching upstream changes from
https://DarrelR#bitbucket.org/harver/android-recruiter-app.git
16:52:08 > git --version # timeout=10
16:52:08 using GIT_ASKPASS to set credentials
16:52:08 > git fetch --tags --progress
https://DarrelR#bitbucket.org/harver/android-recruiter-app.git
+refs/heads/*:refs/remotes/origin/*
16:52:12 > git rev-parse refs/remotes/origin/master^{commit} #
timeout=10
16:52:12 > git rev-parse refs/remotes/origin/origin/master^{commit} #
timeout=10
16:52:12 Checking out Revision
1609ea0ced1febf6a6cbb8bbd9488637c2c70e1a (refs/remotes/origin/master)
16:52:12 > git config core.sparsecheckout # timeout=10
16:52:12 > git checkout -f 1609ea0ced1febf6a6cbb8bbd9488637c2c70e1a
16:52:12 Commit message: "Merged in AMOB-264-end-to-end-testing-for-
the-cand (pull request #57)"
16:52:12 > git rev-list --no-walk
1609ea0ced1febf6a6cbb8bbd9488637c2c70e1a # timeout=10
16:52:12 [Gradle] - Launching build.
16:52:12 [android-recruiter-app] $ /var/lib/jenkins/workspace/android-
recruiter-app/gradlew clean assembleDebug test connectedAndroidTest
16:52:12 Starting a Gradle Daemon (subsequent builds will be faster)
16:52:16
16:52:16 FAILURE: Build failed with an exception.
16:52:16
16:52:16 * What went wrong:
16:52:16 A problem occurred configuring project ':app'.
16:52:16 > The SDK directory '/media/darrel/NewDisk' does not exist.
16:52:16
16:52:16 * Try:
16:52:16 Run with --stacktrace option to get the stack trace. Run with
--info or --debug option to get more log output. Run with --scan to
get full insights.
16:52:16
16:52:16 * Get more help at https://help.gradle.org
16:52:16
16:52:16 BUILD FAILED in 4s
16:52:16 Build step 'Invoke Gradle script' changed build result to
FAILURE
16:52:16 Build step 'Invoke Gradle script' marked build as failure
16:52:17 Finished: FAILURE
I found a solution for my problem from this. I had to update the access permission for the user to access the mounted drive using the below steps
1.Unmount the mounted device (/dev/sdb is the hard disk detected name)
umount /dev/sdb
chmod -R 0777 /mnt/
2.Finally mount the hard
mount /dev/sdb /mnt
3.Then I gave the sdk path as /mnt/Android/Sdk
I recently set up a Jenkins build server for my Android projects running on Ubuntu 16.04. I've got it mostly working to where it will pull from GitHub and attempt to build a project. For some reason whenever I set up a task to run gradlew build or gradlew assembleDebug, it always fails with some AAPT2 error. I say some because one project is giving me a different AAPT2 error than another project. Both of these projects compile without problem on my local Windows machine.
Jenkins is pointed to the most recent sdk-tools (https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip) located at /opt/android-sdk on the Jenkins machine. The Jenkins machine is configured with oracle-java-8.
The console output for project 1:
[Gradle] - Launching build.
[Test] $ /var/lib/jenkins/workspace/Test/gradlew clean assembleDebug
Starting a Gradle Daemon (subsequent builds will be faster)
File /var/lib/jenkins/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 27.0.3 in /opt/android-sdk/licenses
License for package Android SDK Build-Tools 27.0.3 accepted.
Preparing "Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)".
"Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" ready.
Installing Android SDK Build-Tools 27.0.3 in /opt/android-sdk/build-tools/27.0.3
"Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" complete.
"Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" finished.
Checking the license for package Android SDK Platform 27 in /opt/android-sdk/licenses
License for package Android SDK Platform 27 accepted.
Preparing "Install Android SDK Platform 27 (revision: 3)".
"Install Android SDK Platform 27 (revision: 3)" ready.
Installing Android SDK Platform 27 in /opt/android-sdk/platforms/android-27
"Install Android SDK Platform 27 (revision: 3)" complete.
"Install Android SDK Platform 27 (revision: 3)" finished.
Checking the license for package Android SDK Platform-Tools in /opt/android-sdk/licenses
License for package Android SDK Platform-Tools accepted.
Preparing "Install Android SDK Platform-Tools (revision: 28.0.0)".
"Install Android SDK Platform-Tools (revision: 28.0.0)" ready.
Installing Android SDK Platform-Tools in /opt/android-sdk/platform-tools
"Install Android SDK Platform-Tools (revision: 28.0.0)" complete.
"Install Android SDK Platform-Tools (revision: 28.0.0)" finished.
:clean
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:checkDebugManifest
:app:generateDebugBuildConfig
:app:mainApkListPersistenceDebug
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResourcesAAPT err(Facade for 27706406): /opt/android-sdk/build-tools/27.0.3/aapt2: 1: /opt/android-sdk/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
AAPT err(Facade for 26922534): /opt/android-sdk/build-tools/27.0.3/aapt2: 1: /opt/android-sdk/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
AAPT err(Facade for 32626108): /opt/android-sdk/build-tools/27.0.3/aapt2: 1: /opt/android-sdk/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
AAPT err(Facade for 26996178): /opt/android-sdk/build-tools/27.0.3/aapt2: 1: /opt/android-sdk/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
Slave 32626108 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /opt/android-sdk/build-tools/27.0.3/aapt2) are not corrupted.
at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
at java.lang.Thread.run(Thread.java:748)
Slave 26922534 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /opt/android-sdk/build-tools/27.0.3/aapt2) are not corrupted.
at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
at java.lang.Thread.run(Thread.java:748)
Slave 27706406 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /opt/android-sdk/build-tools/27.0.3/aapt2) are not corrupted.
at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_1" java.util.MissingFormatArgumentException: Format specifier '%1$s'
Slave 26996178 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /opt/android-sdk/build-tools/27.0.3/aapt2) are not corrupted.
at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
at java.lang.Thread.run(Thread.java:748)
at java.util.Formatter.format(Formatter.java:2525)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_4" java.util.MissingFormatArgumentException: Format specifier '%1$s'
at java.util.Formatter.format(Formatter.java:2525)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_3" java.util.MissingFormatArgumentException: Format specifier '%1$s'
at java.util.Formatter.format(Formatter.java:2525)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_2" java.util.MissingFormatArgumentException: Format specifier '%1$s'
at java.util.Formatter.format(Formatter.java:2525)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
at java.lang.Thread.run(Thread.java:748)
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
:app:createDebugCompatibleScreenManifests
:app:processDebugManifest
:app:splitsDiscoveryTaskDebug
:app:prepareLintJar UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:mergeDebugJniLibFolders
:app:transformNativeLibsWithMergeJniLibsForDebug
:app:processDebugJavaRes NO-SOURCE
:app:validateSigningDebug
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4m 33s
20 actionable tasks: 19 executed, 1 up-to-date
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
The console output for project 2:
[Gradle] - Launching build.
[ProjectName] $ /var/lib/jenkins/workspace/ProjectName/gradlew clean assembleDebug
Starting a Gradle Daemon (subsequent builds will be faster)
File /var/lib/jenkins/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Platform 28 in /opt/android-sdk/licenses
License for package Android SDK Platform 28 accepted.
Preparing "Install Android SDK Platform 28 (revision: 4)".
"Install Android SDK Platform 28 (revision: 4)" ready.
Installing Android SDK Platform 28 in /opt/android-sdk/platforms/android-28
"Install Android SDK Platform 28 (revision: 4)" complete.
"Install Android SDK Platform 28 (revision: 4)" finished.
:clean UP-TO-DATE
:app:clean
:app:checkDebugClasspath
:app:preBuild UP-TO-DATE
:app:preDebugBuild
:app:compileDebugAidl NO-SOURCE
:app:compileDebugRenderscript
:app:checkDebugManifest
:app:generateDebugBuildConfig
:app:generateSafeArgsDebug
:app:prepareLintJar
:app:mainApkListPersistenceDebug
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResourcesAAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #2: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #0: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #1: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #4: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #3: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #5: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #7: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #6: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #2: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3m 27s
12 actionable tasks: 11 executed, 1 up-to-date
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
I'm really not sure why I'm getting these results, especially as both of the projects build just fine on my local Windows machine. Perhaps I'm missing something I should have installed on the Jenkins machine? I'm hoping there's an answer other than disabling aapt2 in gradle.properties as it doesn't really find the problem here.
When I try to do Build Android-studio project in jenkins I get this error:
Could not create service of type FileCollectionSnapshotterRegistry using TaskExecutionServices.createFileCollectionSnapshotterRegistry().
Could not create service of type CachingFileHasher using TaskExecutionServices.createFileSnapshotter().
I didn't found a answer any place, please help me :)
Started by user admin
Building in workspace /var/lib/jenkins/workspace/AndroidProject
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/ShiraOzeri/Try_MyTest # timeout=10
Fetching upstream changes from https://github.com/ShiraOzeri/Try_MyTest
> git --version # timeout=10
> git fetch --tags --progress https://github.com/ShiraOzeri/Try_MyTest +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 78a492d135b437ee188d71ba44a060540fc56a95 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 78a492d135b437ee188d71ba44a060540fc56a95
> git rev-list 78a492d135b437ee188d71ba44a060540fc56a95 # timeout=10
[Gradle] - Launching build.
[AndroidProject] $ /var/lib/jenkins/workspace/AndroidProject/gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)
Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type FileCollectionSnapshotterRegistry using TaskExecutionServices.createFileCollectionSnapshotterRegistry().
> Could not create service of type CachingFileHasher using TaskExecutionServices.createFileSnapshotter().
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 7.083 secs
FAILURE: Build failed with an exception.
* What went wrong:
java.nio.file.AccessDeniedException: /var/lib/jenkins/workspace/AndroidProject/build/android-profile/profile-2017-06-19-18-24-07-215.rawproto
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
So. my solution:
first, you need to check if you have gradle
To test the Gradle installation, just run Gradle from the command-line:
gradle
second, this help me a lot,
try this:
chown -R jenkins:jenkins <Path to your jenkins>
example: chown -R jenkins:jenkins /var/lib/jenkins/
Thanks!!
You can see it clearly in the error "AccessDeniedException"
What went wrong:
java.nio.file.AccessDeniedException: /var/lib/jenkins/workspace/AndroidProject/build/android-profile/profile-2017-06-19-18-24-07-215.rawproto
You probably have a user/group permissions problem. Try to see if the Jenkins user have permissions to make changes in that folder (since Jenkins has different user).
I had the same problem. Seems like some process is holding the lock for it.
I tried removing the taskArtifacts from .gradle folder in the workspace but that didn't work.
Ultimately, just a restart of Android Studio did the trick!
Note: I didn't try the chown command as mentioned in the original question.
All the things happened after I made several commands for the ionic App with ngCordova
- ionic start "App Project Name"
- ionic platform add android
- ionic build android
:processDebugResources Unable to add '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/assets/debug/www/node_modules/try-thread-sleep/node_modules/thread-sleep/node_modules/node-pre-gyp/node_modules/tar-pack/test/fixtures/packed.tar.gz': file already in archive (try '-u'?)
ERROR: unable to process assets while packaging '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/resources-debug.ap_'
ERROR: packaging of '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/resources-debug.ap_' failed
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processDebugResources'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/desmondlai/Library/Android/sdk/build-tools/23.0.2/aapt package -f --no-crunch -I /Users/desmondlai/Library/Android/sdk/platforms/android-22/android.jar -M /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/debug -A /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/assets/debug -m -J /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/generated/source/r/debug -F /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package com.ionicframework.starter -0 apk --output-text-symbols /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/symbols/debug
Error Code:
1
Output:
Unable to add '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/assets/debug/www/node_modules/try-thread-sleep/node_modules/thread-sleep/node_modules/node-pre-gyp/node_modules/tar-pack/test/fixtures/packed.tar.gz': file already in archive (try '-u'?)
ERROR: unable to process assets while packaging '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/resources-debug.ap_'
ERROR: packaging of '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/resources-debug.ap_' failed
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 45.169 secs
/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/cordova/build: Command failed with exit code 1
Add/remove android didn't fix the problem for me either.
Generating the project resources fixed the issue for me.
ionic resources
Add xml namespace xmlns:gap="http://phonegap.com/ns/1.0" to your config.xml
also, if you are using linux you must do "sudo chmod 755 gradlew" before you do the "./gradlew clean" to make sure it is executable
delete your icon folder splashscreen folder
then follow these commands
sudo npm install ionic-resources -g
ionic resources android
I'm using phonegap 100% from the command line. If I build while connected to the internet it works
$ phonegap build android
[phonegap] executing 'cordova build android'...
[phonegap] completed 'cordova build android'
But if I disconnect from the internet I get errors
$ phonegap build android
[phonegap] executing 'cordova build android'...
cp: no such file or directory: /Users/gregg/src/hft-mobile-app/icon.png
Running command: /Users/gregg/src/hft-mobile-app/platforms/android/cordova/build
ANDROID_HOME=/Users/gregg/Downloads/android-sdk-macosx
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Running: /Users/gregg/src/hft-mobile-app/platforms/android/gradlew cdvBuildDebug -b /Users/gregg/src/hft-mobile-app/platforms/android/build.gradle -Dorg.gradle.daemon=true
FAILURE:
Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:1.0.0+.
Required by:
:android:unspecified
>
Failed to list versions for com.android.tools.build:gradle.
>
Unable to load Maven meta-data from https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml.
>
Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml'.
>
repo1.maven.org: nodename nor servname provided, or not known
* Try:
Run with
--stacktrace option to get the stack trace. Run with
--info
or --debug
option to get more log output.
BUILD FAILED
Total time: 30.753 secs
/Users/gregg/src/hft-mobile-app/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/gregg/src/hft-mobile-app/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/gregg/src/hft-mobile-app/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/gregg/src/hft-mobile-app/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/gregg/src/hft-mobile-app/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
Why is the command line version phoning home? How do I get this to build 100% offline?
Note: I see this error as the 2nd line when trying to build offline
cp: no such file or directory: /Users/gregg/src/hft-mobile-app/icon.png
But as you can see that error does not occur online. Plus supposedly whatever that issue was was fixed according to this
I'm on OSX, I've got the Android SDK installed. I had no idea it was calling home. How do I get it to build offline?
This is what I have experienced till now. Ionic uses gradle for android build. It first time downloads all the dependencies from internet. So internet is most for first gradle build but it caches them and no internet is needed for further build.Since you are having problem why don't you globally update your cordova and ionic.
npm install -g cordova ionic