[JIRA] (JENKINS-41787) Android Signing plugin command not correct...

62 views
Skip to first unread message

adanecito@yahoo.com (JIRA)

unread,
Feb 6, 2017, 11:40:02 PM2/6/17
to jenkinsc...@googlegroups.com
Tony Anecito created an issue
 
Jenkins / Bug JENKINS-41787
Android Signing plugin command not correct...
Issue Type: Bug Bug
Assignee: Robert St. John
Components: android-signing-plugin
Created: 2017/Feb/07 4:39 AM
Environment: Windows 10
Priority: Blocker Blocker
Reporter: Tony Anecito

Jenkins 2.44, android-signing-plugin 2.0.7, Windows 10, Java 1.8.0_91

When the signing plugin runs during the build I get an error:
Total time: 4 mins 24.557 secs
Build step 'Invoke Gradle script' changed build result to SUCCESS
[SignApksBuilder] found zipalign path in env ANDROID_ZIPALIGN=d:\android-studio\build-tools\25.0.2
[Disaster Center] $ d:\android-studio\build-tools\25.0.2 -f -p 4 "C:\Users\xxxx\.jenkins\workspace\Disaster Center\app\build\outputs\apk\app-release-unsigned.apk" "C:\Users\xxxx\.jenkins\workspace\Disaster Center\app\build\outputs\apk\app-release-unsigned-aligned.apk"
Access is denied
FATAL: Cannot run program "d:\android-studio\build-tools\25.0.2" (in directory "C:\Users\xxxx\.jenkins\workspace\Disaster Center"): CreateProcess error=5, Access is denied
java.io.IOException: Cannot run program "d:\android-studio\build-tools\25.0.2" (in directory "C:\Users\xxxx\.jenkins\workspace\Disaster Center"): CreateProcess error=5, Access is denied
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:245)
at hudson.Proc$LocalProc.<init>(Proc.java:214)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:846)
at hudson.Launcher$ProcStarter.start(Launcher.java:384)
at hudson.Launcher$ProcStarter.join(Launcher.java:395)
at org.jenkinsci.plugins.androidsigning.SignApksBuilder.perform(SignApksBuilder.java:158)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Caused by: java.io.IOException: CreateProcess error=5, Access is denied
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 17 more
Archiving artifacts
Finished: FAILURE

If I run the above command from the directory mentioned above and include \zipalign it creates the align version of the apk. Since I do not know what command would run after that one to sign I am stuck and can not use Jenkins for Continuous Deployment.

Thanks!

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

restjohn@gmail.com (JIRA)

unread,
Feb 7, 2017, 1:23:02 AM2/7/17
to jenkinsc...@googlegroups.com
Robert St. John commented on Bug JENKINS-41787
 
Re: Android Signing plugin command not correct...

The logging you provided indicates that you simply need to append \zipalign to the value of your ANDROID_ZIPALIGN variable, so the full value of ANDROID_ZIPALIGN should be d:\android-studio\build-tools\25.0.2\zipalign. The plugin expects the value of ANDROID_ZIPALIGN to be the full path to the zipalign executable, rather the parent directory. My apologies if that is not clear in the README. I'll modify it to provide specific examples. Please let me know in a comment if that fixes your problem.

Cheers

restjohn@gmail.com (JIRA)

unread,
Feb 7, 2017, 1:24:01 AM2/7/17
to jenkinsc...@googlegroups.com
Robert St. John edited a comment on Bug JENKINS-41787
The logging you provided indicates that you simply need to append {{\zipalign}} to the value of your {{ANDROID_ZIPALIGN}} variable, so the full value of {{ANDROID_ZIPALIGN}} should be {{d:\android-studio\build-tools\25.0.2\zipalign}}.  The plugin expects the value of {{ANDROID_ZIPALIGN}} to be the full path to the {{zipalign}} executable, rather than the parent directory.  My apologies if that is not clear in the [README|https://github.com/jenkinsci/android-signing-plugin].  I'll modify it to provide specific examples.  Please let me know in a comment if that fixes your problem.

Cheers

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 9:17:04 AM2/7/17
to jenkinsc...@googlegroups.com

Thanks I will give it a try. Yes examples would be a big help. FYI, I usually do not include an executable in the path just the path to the directory where it resides otherwise the path would get full of executable s. So you might want to do it that way.
I will try what you suggest and then comment on it it fixed the issue.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 9:17:04 AM2/7/17
to jenkinsc...@googlegroups.com
Tony Anecito edited a comment on Bug JENKINS-41787
Thanks I will give it a try. Yes examples would be a big help. FYI, I usually do not include an executable in the path just the path to the directory where it resides otherwise the path would get full of executable s. So you might want to do it that way.
I will try what you suggest and then comment on if it it fixed the issue.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 9:18:02 AM2/7/17
to jenkinsc...@googlegroups.com
Tony Anecito edited a comment on Bug JENKINS-41787
Thanks I will give it a try. Yes examples would be a big help. FYI, I usually do not include an executable in the path for the variable just the path to the directory where it resides otherwise the path would get full of executable s. So you might want to do it that way.
I will try what you suggest and then comment on if it fixed the issue.

restjohn@gmail.com (JIRA)

unread,
Feb 7, 2017, 9:43:01 AM2/7/17
to jenkinsc...@googlegroups.com

ANDROID_ZIPALIGN is intended to be more of a one-off override that you can setup in the Jenkins system configuration or on a per-job basis. If you are relying on the environment variables Jenkins inherits from your OS, the plugin will currently attempt to find zipalign in the latest version of the build-tools package located in the directory referenced by ANDROID_HOME, so you can setting ANDROID_HOME at the OS level instead. In your case, that appears to be d:\android-studio.

restjohn@gmail.com (JIRA)

unread,
Feb 7, 2017, 9:44:01 AM2/7/17
to jenkinsc...@googlegroups.com
Robert St. John edited a comment on Bug JENKINS-41787
{{ANDROID_ZIPALIGN}} is intended to be more of a one-off override that you can setup in the Jenkins system configuration or on a per-job basis.  If you are relying on the environment variables Jenkins inherits from your OS, the plugin will currently attempt to find {{zipalign}} in the latest version of the build-tools package located in the directory referenced by {{ANDROID_HOME}}, so you can setting {{ANDROID_HOME}} at the OS level instead.  In your case, that appears to be {{d:\android-studio}}.   I will consider also trying to find {{zipalign}} from the OS {{PATH}} variable as well, but that would be in a future release.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 9:56:01 AM2/7/17
to jenkinsc...@googlegroups.com

Thanks for the update I will try that also so I do not need the one-off as you mentioned.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 12:11:01 PM2/7/17
to jenkinsc...@googlegroups.com

I already had ANDROID_HOME setup just like you mentioned and that did not solve this issue. Perhaps that has not been released yet or perhaps it is looking in a specific directory I do not have the zipalign.exe in? I did add zipalign as you suggested and that worked.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 12:20:01 PM2/7/17
to jenkinsc...@googlegroups.com

Almost worked. I get the error about zipalign not being a valid win32 application I will have to figure that one out. It works fine from a command line.

restjohn@gmail.com (JIRA)

unread,
Feb 7, 2017, 12:32:01 PM2/7/17
to jenkinsc...@googlegroups.com

You might need to resort to using the ANDROID_ZIPALIGN variable and add .exe to the end. I've not had a chance to test on Windows, so I might need to put in a fix to add the .exe extensions on Windows hosts.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 12:42:01 PM2/7/17
to jenkinsc...@googlegroups.com

Ok I will try. FYI, I did take the complete command line put it in a batch file and ran it from the directory the plugin tried and it worked.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 12:57:01 PM2/7/17
to jenkinsc...@googlegroups.com

I am thinking it is a permissions issue and Jenkins conflicting with anti-virus software. I am running some tests now to confirm my guess.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 1:23:01 PM2/7/17
to jenkinsc...@googlegroups.com

Ok it was not an issue with the anti-virus and adding the .exe solved creating the signed apk but archiving failed but that is not an issue with the plugin I think.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 1:28:01 PM2/7/17
to jenkinsc...@googlegroups.com

Ok there is an checkbox for the plugin for archiving. I unselected that since I already have a post-build action to archive the apks and that does work. I am not sure why the plugin was not allowed to create a directory for archiving that is what the error was.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 1:35:01 PM2/7/17
to jenkinsc...@googlegroups.com

Okay, the signing does not fail if I un-check the archive signed jars. You can close this issue and mention in a windows example the correct suffix for the zipalign.
Thanks for the quick replies!

restjohn@gmail.com (JIRA)

unread,
Feb 7, 2017, 2:02:02 PM2/7/17
to jenkinsc...@googlegroups.com

No problem, I'm glad you got it working. I'll try to get a Windows test environment setup to avoid future Windows discrepancies. Hopefully I can a release done today to fix this issue.

restjohn@gmail.com (JIRA)

unread,
Feb 7, 2017, 2:06:01 PM2/7/17
to jenkinsc...@googlegroups.com

Do you mind also posting your build log from when the archive artifacts failed? I'd like to verify that's not another issue with the plugin.

restjohn@gmail.com (JIRA)

unread,
Feb 7, 2017, 2:07:01 PM2/7/17
to jenkinsc...@googlegroups.com
Robert St. John edited a comment on Bug JENKINS-41787
Do you mind also posting your build log from when the archive artifacts failed?  I'd like to verify that's not another issue with the plugin.   You could also email it to me separately if you like.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 4:34:03 PM2/7/17
to jenkinsc...@googlegroups.com

Here is the console output. I do not know where to find the build logs.

FATAL: Failed to create a directory at C:\Users\xxxx\.jenkins\jobs\Disaster Center\builds\11\archive\C:\Users\xxxx\.jenkins\workspace\Disaster Center\app\build\outputs\apk
java.io.IOException: Failed to create a directory at C:\Users\xxxx\.jenkins\jobs\Disaster Center\builds\11\archive\C:\Users\xxxx.jenkins\workspace\Disaster Center\app\build\outputs\apk
at hudson.util.IOUtils.mkdirs(IOUtils.java:66)
at hudson.FilePath.mkdirsE(FilePath.java:2914)
at hudson.FilePath.access$2000(FilePath.java:195)
at hudson.FilePath$42$1.visit(FilePath.java:2133)
at hudson.util.DirScanner.scanSingle(DirScanner.java:49)
at hudson.FilePath$ExplicitlySpecifiedDirScanner.scan(FilePath.java:2804)
at hudson.FilePath$42.invoke(FilePath.java:2128)
at hudson.FilePath$42.invoke(FilePath.java:2121)
at hudson.FilePath.act(FilePath.java:996)
at hudson.FilePath.act(FilePath.java:974)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2121)
at jenkins.model.StandardArtifactManager.archive(StandardArtifactManager.java:61)
at org.jenkinsci.plugins.androidsigning.SignApksBuilder.perform(SignApksBuilder.java:194)


at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)

Archiving artifacts
Finished: FAILURE

restjohn@gmail.com (JIRA)

unread,
Feb 7, 2017, 5:28:17 PM2/7/17
to jenkinsc...@googlegroups.com

Thanks for the log, much appreciated. I just released version 2.0.8 which should allow you to use ANDROID_HOME from the OS or the Jenkins system configuration. I'd appreciate your feedback whenever you get a chance to try it.

restjohn@gmail.com (JIRA)

unread,
Feb 7, 2017, 5:30:01 PM2/7/17
to jenkinsc...@googlegroups.com
Robert St. John edited a comment on Bug JENKINS-41787
Thanks for the log, much appreciated.  I just released version 2.0.8 of the plugin which should allow you to use {{ANDROID_HOME}} from the OS or the Jenkins system configuration.  I'd appreciate your feedback whenever you get a chance to try it.   Jenkins might take a little while before making it available in the update manager.

scm_issue_link@java.net (JIRA)

unread,
Feb 7, 2017, 6:13:01 PM2/7/17
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: restjohn
Path:
src/main/java/org/jenkinsci/plugins/androidsigning/SignApksBuilder.java
http://jenkins-ci.org/commit/android-signing-plugin/df10f6e70ffd101a58ccbfc7580045219e5c5450
Log:
should be a fix for a bug uncovered while testing JENKINS-41787, archiving the output apk(s)

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 6:39:02 PM2/7/17
to jenkinsc...@googlegroups.com

Sure. I will try it and let you know as soon as Jenkins makes it available.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 10:56:01 PM2/7/17
to jenkinsc...@googlegroups.com

Do not feel bad I found the Android Emulator Plugin was using the Linux / rather than the windows \ when appending to the ANDROID_SDK_HOME on a Windows OS. Yes, I reported it.

restjohn@gmail.com (JIRA)

unread,
Feb 7, 2017, 11:08:02 PM2/7/17
to jenkinsc...@googlegroups.com

Thanks for your concern. Rest assured, I don't feel bad. I appreciate your feedback and efforts to make the software better, and I am glad it's getting some use. Admittedly, I also consciously discriminate against Windows because I do not enjoy the developer experience. That's probably due mostly to inertia and ignorance, though, so I'm glad users such as you are around to keep me on the level and remind me that mine is not the only perspective out there. I have a Windows VM setup now, so hopefully I can minimize any more OS-related discrepancies for future releases. Let me know if you have any more issues.

adanecito@yahoo.com (JIRA)

unread,
Feb 7, 2017, 11:20:01 PM2/7/17
to jenkinsc...@googlegroups.com

Thanks I do have a windows 10 laptop setup with Ubuntu but it takes forever now to boot up since I added Docker. I like Linux but can never get around to dedicating a machine for it at home.
Glad to help but do not let the rest of the Jenkins team know that I am soooo busy now just writing Mobile apps and Microservices ugh.

restjohn@gmail.com (JIRA)

unread,
Feb 8, 2017, 8:29:01 AM2/8/17
to jenkinsc...@googlegroups.com
Robert St. John started work on Bug JENKINS-41787
 
Change By: Robert St. John
Status: Open In Progress

restjohn@gmail.com (JIRA)

unread,
Feb 8, 2017, 8:47:02 AM2/8/17
to jenkinsc...@googlegroups.com
Robert St. John resolved as Fixed
 

Fixed by https://github.com/jenkinsci/android-signing-plugin/commit/262e9eee64b82148c16a6cb8bd59be101988bc7a, in the message of which I forgot to reference this ticket.

Jenkins / Bug JENKINS-41787
Change By: Robert St. John
Status: In Progress Resolved
Resolution: Fixed
Reply all
Reply to author
Forward
0 new messages