Uploading Andorid Client app to HockeyApp

rajindersingh's Avatar

rajindersingh

04 Aug, 2015 05:02 PM

I have successfully build xamarin android application using AppVeyor
Next step for us to to upload to HockeyApp.
We want to use a deployment project to upload to HockeyApp.
Do we need to package custom artifacts to make them available in deployment project.

I found a command line utility that uploads from windows to hockey app.
https://github.com/bitstadium/HockeyApp-for-Windows

I was wondering if anyone has already thought through this. Ideally I would like native support of HockeyApp and Google store.
Until this is developed I need help in coming up with a temporary process of uploading applications to Hockeyapp and Google store.

Thanks

  1. Support Staff 1 Posted by Feodor Fitsner on 04 Aug, 2015 07:14 PM

    Feodor Fitsner's Avatar

    Yes, the build should produce artifacts that can be later deployed from a separate project ("deployment " project).

    We already have working example in this two repos:

    Web app initiates deployment (starts a new "deploy-project" build) using REST API: https://github.com/appveyor/simple-web/blob/master/appveyor.yml#L19...

    Deployment project uses helper script to download artifacts from web app project: https://github.com/FeodorFitsner/deploy-project/blob/master/appveyo...

    then deploy artifacts with any method (Web Deploy in our case, but you would probably go with PowerShell): https://github.com/FeodorFitsner/deploy-project/blob/master/appveyo...

    Let me know what you think. I'm going to blog about that.

  2. 2 Posted by rajindersingh on 17 Aug, 2015 02:21 AM

    rajindersingh's Avatar

    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.

    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.

    I want to create a deployment project which will push to HockeyApp.
    It has to download the artifact and then use Hockey App API to upload this APK file.

    http://support.hockeyapp.net/kb/api/api-apps#upload-app

    Here are a few questions:
    1. What type of environment project should I create?
    2. I am trying to study this deployment project sample you provided above:
    https://github.com/FeodorFitsner/deploy-project/blob/master/appveyor.yml

    Is this appveyor.yml the same as the appveyor.yml that I used to build my project?
    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.

    Thanks

  3. 3 Posted by rajindersingh on 17 Aug, 2015 04:16 AM

    rajindersingh's Avatar

    In addition to my questions above I found that the best way to upload an android apk file to hockeyapp is to use Curl.

    I am assuming that curl is not available in the worker image.

    Right now my artifact only contain 1 files androidclient.apk

    What is the best way to make curl available in a deployment project.

    Since we are upload a file via rest API most people chose Curl over PowerShell

    curl \
      -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" \
      https://rink.hockeyapp.net/api/2/apps/1234567890abcdef1234567890abcdef/app_versions/upload

    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?

  4. Support Staff 4 Posted by Feodor Fitsner on 17 Aug, 2015 05:12 PM

    Feodor Fitsner's Avatar

    Yes, that's correct you can't execute scripts when using Environments. This is because those deployments run on shared cloud servers.

    curl can be downloaded during the build from here: http://curl.haxx.se/download.html

    However, I'd use PowerShell with System.Net.WebClient class to upload the file.

  5. 5 Posted by rajindersingh on 17 Aug, 2015 08:50 PM

    rajindersingh's Avatar

    I was able to use chocolatey to install curl.
    However my call to deploy.ps1 is failing.

    before_deploy:
    - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/deploy.ps1'))

    Invoke-RestMethod : {"message":"Project not found or access denied."}
    At line:23 char:12
    + $project = Invoke-RestMethod -Method Get -Uri $buildUrl -Headers $headers
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
        + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

    I did generate an api token and encrypted it.

    api_token:
        secure: xxxxxxxxxxxx=

    Any suggestions for troubleshooting this issue?

    I need to use these commands to build, package and sign the andriod client.

    # First clean the Release target.
    msbuild.exe HelloWorld.csproj /p:Configuration=Release /t:Clean

    # Now build the project, using the Release target.
    msbuild.exe HelloWorld.csproj /p:Configuration=Release /t:PackageForAndroid

    # At this point there is only the unsigned APK - sign it.
    # The script will pause here as jarsigner prompts for the password.
    # It is possible to provide they keystore password for jarsigner.exe by adding an extra command line parameter -storepass, for example
    # -storepass <MY_SECRET_PASSWORD>
    # 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.
    & '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

    # Now zipalign it. The -v parameter tells zipalign to verify the APK afterwards.
    & 'C:\Program Files\Android\android-sdk\tools\zipalign.exe' -f -v 4 ./bin/Release/mono.samples.helloworld-signed.apk ./helloworld.apk

    Can you confirm if jarsigner and zipalign are avaialble on the build image at these locations?

    Thanks

    ps: This will make a great blog post.

  6. Support Staff 6 Posted by Feodor Fitsner on 17 Aug, 2015 08:57 PM

    Feodor Fitsner's Avatar

    Make sure deploy_project variable contains correct project slug. It's not the name of the project - it's a slug you can see in URL while opening it in the browser.

    I'm not sure about zipalign and jarsigner tools, but you may look around VM via RDP: http://www.appveyor.com/docs/how-to/rdp-to-build-worker

  7. 7 Posted by rajindersingh on 17 Aug, 2015 09:32 PM

    rajindersingh's Avatar

    Feodor,

    Can you tell me where to find jarsigner and zipalign on the xamarin VM?
    these will be needed by any xamarin user.

    I am getting system cannot find the specified file errors.

    & '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

    # Now zipalign it. The -v parameter tells zipalign to verify the APK afterwards.
    & 'C:\Program Files\Android\android-sdk\tools\zipalign.exe' -f -v 4 ./bin/Release/mono.samples.helloworld-signed.apk ./helloworld.apk

    Can you confirm if jarsigner and zipalign are avaialble on the build image at these locations?

  8. 8 Posted by rajindersingh on 17 Aug, 2015 09:57 PM

    rajindersingh's Avatar

    I found Java path. It is C:\Program Files\Java\jdk1.7.0\bin

    However I don't see any reference to android-sdk.
    On xamarin image android-sdk should be present.

    I need zipalign.exe. In the worst case I will check it into my source code.

  9. Support Staff 9 Posted by Feodor Fitsner on 17 Aug, 2015 10:30 PM

    Feodor Fitsner's Avatar

    Wow, Android SDK is actually installed in C:\Users\appveyor\AppData\Local\Android\android-sdk or better %LocalAppData%\Android\android-sdk

    zipalign.exe path is %LocalAppData%\Android\android-sdk\build-tools\22.0.1\zipalign.exe

  10. 10 Posted by rajindersingh on 17 Aug, 2015 10:38 PM

    rajindersingh's Avatar

    In my desperation I checked in zipalign.exe

    My xamarin android application built successfully and deployed successfully to HockeyApp.

    I will blog about this as it is quite a journey.

  11. Support Staff 11 Posted by Feodor Fitsner on 17 Aug, 2015 10:39 PM

    Feodor Fitsner's Avatar

    That would be great, thank you!

  12. 12 Posted by rajindersingh on 18 Aug, 2015 12:37 AM

    rajindersingh's Avatar

    Feodor,

    I did not see Android SDK mentioned in the list of software installed on the VM images.
    Perhaps I was looking at the wrong place.
    What is the easiest way to find the paths for all the software that is installed on the build VM?

    Raj

  13. Support Staff 13 Posted by Feodor Fitsner on 18 Aug, 2015 12:40 AM

    Feodor Fitsner's Avatar

    I don't think it's being registered to "Add/remove programs" list.

    The location of information about installation path depends on application. There is no common way to discover that.

  14. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:59 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac