Xamarin.Android Continuous Integration with Visual Studio Team Services

Have you or someone you know been physically harmed or emotionally scarred by the stress of setting up Continuous Integration on VSTS for your Xamarin.Android project? If your answer is yes, you are entitled to no compensation, but this blog post might help.

Easily one of the most frustrating experiences I’ve had with CI so far. It seemed that after I worked through one issue breaking the build, another two popped up. It’s like fighting the Hydra of builds.

Of course everything built fine on my local machine as well as on my other developers’ machines! So WTF VSTS???

Let’s look at some common errors you might have run into. If none of these cover your problems, leave a comment and we can try to sort it out after.

“Major version 51 is newer than 50, the highest major version supported by this compiler.”

Maybe you’ve run into this problem during your actual builds in the past. Basically the issue is that the latest Android Support Libraries build with a newer version of the compiler. The fix is simple – in VSTS, set your JDK version explicitly to 8.

  1. In your build definition, go to your Build Xamarin.Android project step
    vstsdroid
  2. Scroll down the the JDK options section
  3. Select JDK Version 
  4. Select JDK 8 from the JDK Version dropdown
    VSTSJDK.PNG
  5. Save
  6. Run

 

“java.lang.OutOfMemoryError. Consider increasing the value of $(JavaMaximumHeapSize)”

The error is at least pretty explanatory. You ran out of memory in your Java Heap.

The solution is to increase your Java Heap explicitly:

  1. In your IDE (VS or XS), go to your Android project
  2. Open the properties for your project
  3. Set your configuration to Release (or whatever configuration your VSTS build runs as)
  4. Go to the Android Options Tab
  5. Go to the Advanced tab
  6. Go down to the Advanced Android Build Settings
  7. Set the Java Max Heap Size to something larger such as “1G”

javaheap

 

These errors can be common and are only applicable to basic Android builds. This does not cover Continuous Deployment to services such as HockeyApp or Visual Studio Mobile Center.

Don’t forget to leave a comment if you’ve run into any different issues!

Advertisements

8 thoughts on “Xamarin.Android Continuous Integration with Visual Studio Team Services”

  1. Hi alex,
    I have a new error for you !
    My solution contain a project with a binded library from a jar. The project compile correctly on my computer but on vsts somme error are found in generated c# files… I don’t think this files are used in my project and I didn’t find yet how to exclude this files…

    Like

      1. Here they are :
        8 errors on my linked project :
        “F:\Agent1\_work\80\s\myproj.Mobile.Android.ScanIdentityCard\myproj.Mobile.Android.ScanIdentityCard.csproj” (default target) (1) ->
        (CoreCompile target) ->
        obj\Release Android\generated\src\Org.Jmrtd.Cert.CVCertificateFactorySpi.cs(9,23): error CS0534: ‘CVCertificateFactorySpi’ does not implement inherited abstract member ‘CertificateFactorySpi.EngineGenerateCRLs(Stream)’ [F:\Agent1\_work\80\s\myproj.Mobile.Android.ScanIdentityCard\Fols.Mobile.Android.ScanIdentityCard.csproj]
        obj\Release Android\generated\src\Org.Jmrtd.Cert.CVCertificateFactorySpi.cs(9,23): error CS0534: ‘CVCertificateFactorySpi’ does not implement inherited abstract member ‘CertificateFactorySpi.EngineGenerateCertificates(Stream)’ [F:\Agent1\_work\80\s\myproj.Mobile.Android.ScanIdentityCard\Fols.Mobile.Android.ScanIdentityCard.csproj]
        obj\Release Android\generated\src\Org.Jmrtd.Cert.KeyStoreCertStoreSpi.cs(9,23): error CS0534: ‘KeyStoreCertStoreSpi’ does not implement inherited abstract member ‘CertStoreSpi.EngineGetCRLs(ICRLSelector)’ [F:\Agent1\_work\80\s\myproj.Mobile.Android.ScanIdentityCard\Fols.Mobile.Android.ScanIdentityCard.csproj]
        obj\Release Android\generated\src\Org.Jmrtd.Cert.KeyStoreCertStoreSpi.cs(9,23): error CS0534: ‘KeyStoreCertStoreSpi’ does not implement inherited abstract member ‘CertStoreSpi.EngineGetCertificates(ICertSelector)’ [F:\Agent1\_work\80\s\myproj.Mobile.Android.ScanIdentityCard\Fols.Mobile.Android.ScanIdentityCard.csproj]
        obj\Release Android\generated\src\Org.Jmrtd.Cert.PKDCertStoreSpi.cs(9,23): error CS0534: ‘PKDCertStoreSpi’ does not implement inherited abstract member ‘CertStoreSpi.EngineGetCRLs(ICRLSelector)’ [F:\Agent1\_work\80\s\myproj.Mobile.Android.ScanIdentityCard\Fols.Mobile.Android.ScanIdentityCard.csproj]
        obj\Release Android\generated\src\Org.Jmrtd.Cert.PKDCertStoreSpi.cs(9,23): error CS0534: ‘PKDCertStoreSpi’ does not implement inherited abstract member ‘CertStoreSpi.EngineGetCertificates(ICertSelector)’ [F:\Agent1\_work\80\s\myproj.Mobile.Android.ScanIdentityCard\Fols.Mobile.Android.ScanIdentityCard.csproj]
        obj\Release Android\generated\src\Noconflict.Org.Ejbca.Cvc.JDKCVCertificateFactory.cs(9,23): error CS0534: ‘JDKCVCertificateFactory’ does not implement inherited abstract member ‘CertificateFactorySpi.EngineGenerateCRLs(Stream)’ [F:\Agent1\_work\80\s\myproj.Mobile.Android.ScanIdentityCard\Fols.Mobile.Android.ScanIdentityCard.csproj]
        obj\Release Android\generated\src\Noconflict.Org.Ejbca.Cvc.JDKCVCertificateFactory.cs(9,23): error CS0534: ‘JDKCVCertificateFactory’ does not implement inherited abstract member ‘CertificateFactorySpi.EngineGenerateCertificates(Stream)’ [F:\Agent1\_work\80\s\myproj.Mobile.Android.ScanIdentityCard\Fols.Mobile.Android.ScanIdentityCard.csproj]
        8 Error(s)
        ##[error]Process ‘msbuild.exe’ exited with code ‘1’.
        ##[section]Finishing: Build Xamarin.Android Fols.Mobile.Android.csproj

        Like

    1. They are theses :
      GetSources OK
      Nuget Restore OK
      xamarin Componenet Restore OK
      Buid xamarin proj KO
      ms build 15.0 x86
      jdk default x86

      Like

      1. I tried to modify jdk version, ms build version… without any improovement.
        I’m going to export my binded library as a dll, that should exclude its code from vsts build and allow me to continue my CI…

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s