tag:help.appveyor.com,2012-11-13:/discussions/questions/1554-uploading-andorid-client-app-to-hockeyappAppVeyor: Discussion 2018-08-25T01:59:11Ztag:help.appveyor.com,2012-11-13:Comment/375646642015-08-04T19:14:03Z2015-08-04T19:14:03ZUploading Andorid Client app to HockeyApp<div><p>Yes, the build should produce artifacts that can be later
deployed from a separate project ("deployment " project).</p>
<p>We already have working example in this two repos:</p>
<ul>
<li>web app: <a href="https://github.com/appveyor/simple-web/blob/master/appveyor.yml">https://github.com/appveyor/simple-web/blob/master/appveyor.yml</a></li>
<li>deployment project: <a href="https://github.com/FeodorFitsner/deploy-project/blob/master/appveyor.yml">
https://github.com/FeodorFitsner/deploy-project/blob/master/appveyo...</a></li>
</ul>
<p>Web app initiates deployment (starts a new "deploy-project"
build) using REST API: <a href="https://github.com/appveyor/simple-web/blob/master/appveyor.yml#L19-L20">
https://github.com/appveyor/simple-web/blob/master/appveyor.yml#L19...</a></p>
<p>Deployment project uses helper script to download artifacts from
web app project: <a href="https://github.com/FeodorFitsner/deploy-project/blob/master/appveyor.yml#L18-L20">
https://github.com/FeodorFitsner/deploy-project/blob/master/appveyo...</a></p>
<p>then deploy artifacts with any method (Web Deploy in our case,
but you would probably go with PowerShell): <a href="https://github.com/FeodorFitsner/deploy-project/blob/master/appveyor.yml#L22-L24">
https://github.com/FeodorFitsner/deploy-project/blob/master/appveyo...</a></p>
<p>Let me know what you think. I'm going to blog about that.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/375646642015-08-17T02:21:26Z2015-08-17T02:21:26ZUploading Andorid Client app to HockeyApp<div><p>I am finally working on this. I was able to create the android
APK file. I am pushing it as a custom artifact. It have verified
that this file exists.</p>
<p>My requirements are to just build the android APK upon checkin
but not trigger a deployment. My client wants to use an environment
project to push the APK file to hockey app.</p>
<p>I want to create a deployment project which will push to
HockeyApp.<br>
It has to download the artifact and then use Hockey App API to
upload this APK file.</p>
<p><a href="http://support.hockeyapp.net/kb/api/api-apps#upload-app">http://support.hockeyapp.net/kb/api/api-apps#upload-app</a></p>
<p>Here are a few questions:<br>
1. What type of environment project should I create?<br>
2. I am trying to study this deployment project sample you provided
above:<br>
<a href="https://github.com/FeodorFitsner/deploy-project/blob/master/appveyor.yml">
https://github.com/FeodorFitsner/deploy-project/blob/master/appveyo...</a></p>
<p>Is this appveyor.yml the same as the appveyor.yml that I used to
build my project?<br>
I want to understand how to tie the appveyor.yml to the environment
project which downloads the APK file and calls rest API for Hockey
App.</p>
<p>Thanks</p></div>rajindersinghtag:help.appveyor.com,2012-11-13:Comment/375646642015-08-17T04:16:53Z2015-08-17T04:16:53ZUploading Andorid Client app to HockeyApp<div><p>In addition to my questions above I found that the best way to
upload an android apk file to hockeyapp is to use Curl.</p>
<p>I am assuming that curl is not available in the worker
image.</p>
<p>Right now my artifact only contain 1 files androidclient.apk</p>
<p>What is the best way to make curl available in a deployment
project.</p>
<p>Since we are upload a file via rest API most people chose Curl
over PowerShell</p>
<p>curl \<br>
-F "status=2" \ -F "notify=1" \ -F "notes=Some new features and
fixed bugs." \ -F "notes_type=0" \ -F "ipa=@androidclient.apk" \ -F
"dsym=@hockeyapp.dSYM.zip" \ -H "X-HockeyAppToken:
4567abcd8901ef234567abcd8901ef23" \ <a href="https://rink.hockeyapp.net/api/2/apps/1234567890abcdef1234567890abcdef/app_versions/upload">
https://rink.hockeyapp.net/api/2/apps/1234567890abcdef1234567890abc...</a></p>
<p>It also seems to me that I cannot define an environment project
that uses script to deploy application. My only option is that
deploy the application after build has completed. Is this
correct?</p></div>rajindersinghtag:help.appveyor.com,2012-11-13:Comment/375646642015-08-17T17:12:44Z2015-08-17T17:12:44ZUploading Andorid Client app to HockeyApp<div><p>Yes, that's correct you can't execute scripts when using
Environments. This is because those deployments run on shared cloud
servers.</p>
<p>curl can be downloaded during the build from here: <a href="http://curl.haxx.se/download.html">http://curl.haxx.se/download.html</a></p>
<p>However, I'd use PowerShell with
<code>System.Net.WebClient</code> class to upload the file.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/375646642015-08-17T20:50:31Z2015-08-17T20:50:31ZUploading Andorid Client app to HockeyApp<div><p>I was able to use chocolatey to install curl.<br>
However my call to deploy.ps1 is failing.</p>
<p>before_deploy:<br>
- ps: iex ((new-object net.webclient).DownloadString('<a href="https://raw.githubusercontent.com/appveyor/ci/master/scripts/deploy.ps1&#39">https://raw.githubusercontent.com/appveyor/ci/master/scripts/deploy...</a>;))</p>
<p>Invoke-RestMethod : {<a href=""Project">message</a> not
found or access denied."}<br>
At line:23 char:12<br>
+ $project = Invoke-RestMethod -Method Get -Uri $buildUrl -Headers
$headers +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +
CategoryInfo : InvalidOperation:
(System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod],
WebException + FullyQualifiedErrorId :
WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand</p>
<p>I did generate an api token and encrypted it.</p>
<p>api_token:<br>
secure: xxxxxxxxxxxx=</p>
<p>Any suggestions for troubleshooting this issue?</p>
<p>I need to use these commands to build, package and sign the
andriod client.</p>
<h1><a name="first-clean-the-release-target-" href="#first-clean-the-release-target-" class="anchor"></a>First clean the Release
target.</h1>
<p>msbuild.exe HelloWorld.csproj /p:Configuration=Release
/t:Clean</p>
<h1><a name="now-build-the-project-using-the-release-target-" href="#now-build-the-project-using-the-release-target-" class="anchor"></a>Now build the
project, using the Release target.</h1>
<p>msbuild.exe HelloWorld.csproj /p:Configuration=Release
/t:PackageForAndroid</p>
<h1>
<a name="at-this-point-there-is-only-the-unsigned-apk-sign-it-" href="#at-this-point-there-is-only-the-unsigned-apk-sign-it-" class="anchor"></a>At this
point there is only the unsigned APK - sign it.</h1>
<h1>
<a name="the-script-will-pause-here-as-jarsigner-prompts-for-the-password-" href="#the-script-will-pause-here-as-jarsigner-prompts-for-the-password-" class="anchor">
</a>The script will pause here as jarsigner prompts for the
password.</h1>
<h1>
<a name="it-is-possible-to-provide-they-keystore-password-for-jarsigner-exe-by-adding-an-extra-command-line-parameter-storepass-for-example" href="#it-is-possible-to-provide-they-keystore-password-for-jarsigner-exe-by-adding-an-extra-command-line-parameter-storepass-for-example" class="anchor">
</a>It is possible to provide they keystore password for
jarsigner.exe by adding an extra command line parameter -storepass,
for example</h1>
<h1><a name="-storepass-my_secret_password-" href="#-storepass-my_secret_password-" class="anchor"></a>-storepass</h1>
<h1>
<a name="if-this-script-is-to-be-checked-in-to-source-code-control-then-it-is-not-recommended-to-include-the-password-as-part-of-this-script-" href="#if-this-script-is-to-be-checked-in-to-source-code-control-then-it-is-not-recommended-to-include-the-password-as-part-of-this-script-" class="anchor">
</a>If this script is to be checked in to source code control then
it is not recommended to include the password as part of this
script.</h1>
<p>& 'C:\Program Files\Java\jdk1.6.0_24\bin\jarsigner.exe'
-verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore
./xample.keystore -signedjar
./bin/Release/mono.samples.helloworld-signed.apk
./bin/Release/mono.samples.helloworld.apk publishingdoc</p>
<h1>
<a name="now-zipalign-it-the-v-parameter-tells-zipalign-to-verify-the-apk-afterwards-" href="#now-zipalign-it-the-v-parameter-tells-zipalign-to-verify-the-apk-afterwards-" class="anchor">
</a>Now zipalign it. The -v parameter tells zipalign to verify the
APK afterwards.</h1>
<p>& 'C:\Program Files\Android\android-sdk\tools\zipalign.exe'
-f -v 4 ./bin/Release/mono.samples.helloworld-signed.apk
./helloworld.apk</p>
<p>Can you confirm if jarsigner and zipalign are avaialble on the
build image at these locations?</p>
<p>Thanks</p>
<p>ps: This will make a great blog post.</p></div>rajindersinghtag:help.appveyor.com,2012-11-13:Comment/375646642015-08-17T20:57:14Z2015-08-17T20:57:14ZUploading Andorid Client app to HockeyApp<div><p>Make sure <code>deploy_project</code> variable contains correct
project <em>slug</em>. It's not the name of the project - it's a
slug you can see in URL while opening it in the browser.</p>
<p>I'm not sure about zipalign and jarsigner tools, but you may
look around VM via RDP: <a href="http://www.appveyor.com/docs/how-to/rdp-to-build-worker">http://www.appveyor.com/docs/how-to/rdp-to-build-worker</a></p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/375646642015-08-17T21:32:38Z2015-08-17T21:32:38ZUploading Andorid Client app to HockeyApp<div><p>Feodor,</p>
<p>Can you tell me where to find jarsigner and zipalign on the
xamarin VM?<br>
these will be needed by any xamarin user.</p>
<p>I am getting system cannot find the specified file errors.</p>
<p>& 'C:\Program Files\Java\jdk1.6.0_24\bin\jarsigner.exe'
-verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore
./xample.keystore -signedjar
./bin/Release/mono.samples.helloworld-signed.apk
./bin/Release/mono.samples.helloworld.apk publishingdoc</p>
<h1>
<a href="#now-zipalign-it-the-v-parameter-tells-zipalign-to-verify-the-apk-afterwards-" class="anchor" name="now-zipalign-it-the-v-parameter-tells-zipalign-to-verify-the-apk-afterwards-">
</a>Now zipalign it. The -v parameter tells zipalign to verify the
APK afterwards.</h1>
<p>& 'C:\Program Files\Android\android-sdk\tools\zipalign.exe'
-f -v 4 ./bin/Release/mono.samples.helloworld-signed.apk
./helloworld.apk</p>
<p>Can you confirm if jarsigner and zipalign are avaialble on the
build image at these locations?</p></div>rajindersinghtag:help.appveyor.com,2012-11-13:Comment/375646642015-08-17T21:57:17Z2015-08-17T21:57:17ZUploading Andorid Client app to HockeyApp<div><p>I found Java path. It is C:\Program Files\Java\jdk1.7.0\bin</p>
<p>However I don't see any reference to android-sdk.<br>
On xamarin image android-sdk should be present.</p>
<p>I need zipalign.exe. In the worst case I will check it into my
source code.</p></div>rajindersinghtag:help.appveyor.com,2012-11-13:Comment/375646642015-08-17T22:30:09Z2015-08-17T22:30:09ZUploading Andorid Client app to HockeyApp<div><p>Wow, Android SDK is actually installed in
<code>C:\Users\appveyor\AppData\Local\Android\android-sdk</code> or
better <code>%LocalAppData%\Android\android-sdk</code></p>
<p>zipalign.exe path is
<code>%LocalAppData%\Android\android-sdk\build-tools\22.0.1\zipalign.exe</code></p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/375646642015-08-17T22:38:03Z2015-08-17T22:38:03ZUploading Andorid Client app to HockeyApp<div><p>In my desperation I checked in zipalign.exe</p>
<p>My xamarin android application built successfully and deployed
successfully to HockeyApp.</p>
<p>I will blog about this as it is quite a journey.</p></div>rajindersinghtag:help.appveyor.com,2012-11-13:Comment/375646642015-08-17T22:39:45Z2015-08-17T22:39:45ZUploading Andorid Client app to HockeyApp<div><p>That would be great, thank you!</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/375646642015-08-18T00:37:31Z2015-08-18T00:37:31ZUploading Andorid Client app to HockeyApp<div><p>Feodor,</p>
<p>I did not see Android SDK mentioned in the list of software
installed on the VM images.<br>
Perhaps I was looking at the wrong place.<br>
What is the easiest way to find the paths for all the software that
is installed on the build VM?</p>
<p>Raj</p></div>rajindersinghtag:help.appveyor.com,2012-11-13:Comment/375646642015-08-18T00:40:23Z2015-08-18T00:40:23ZUploading Andorid Client app to HockeyApp<div><p>I don't think it's being registered to "Add/remove programs"
list.</p>
<p>The location of information about installation path depends on
application. There is no common way to discover that.</p></div>Feodor Fitsner