Search code examples
xamarinxamarin.androidarcore

Implementing ARCore with Xamarin


I'm starting to play around with ARCore with Xamarin, and am running into some issues. I see two sample projects:

  1. https://github.com/dotMorten/ARCore.Xamarin

This is outdated, when I update all of the Xamarin packages to the latest, it results in a lot of build errors. It seems that there were a ton of breaking api changes since this was developed.

  1. https://github.com/xamarin/XamarinComponents/tree/master/Android/ARCore

This is up to date (I think), but their sample "HelloAR" solution doesn't build. It references a JavaGL project, which is supposed to have an obj.jar file but it doesn't exist on github.

/Users/justintoth/Downloads/XamarinComponents-master/Android/ARCore/samples/JavaGL/CSC: Error CS1566: Error reading resource 'obj.jar' -- 'Could not find a part of the path "/Users/justintoth/Downloads/XamarinComponents-master/Android/ARCore/externals/obj.jar".' (CS1566) (JavaGL)

I'm wondering how others are getting started with ARCore with Xamarin? Were you able to get past the build errors above, or are you using a different Xamarin project?


Solution

  • Obj.jar is in "external" jar via http://oss.sonatype.org/content/repositories/releases/de/javagl/obj

    You can look at the cake build file to see how it is downloaded/used as it is contained in the component, same for the arcore.aar.

    XamarinComponents/Android/ARCore/build.cake

    ~~~
    var AAR_VERSION = "1.0.0";
    var AAR_URL = string.Format("https://dl.google.com/dl/android/maven2/com/google/ar/core/{0}/core-{0}.aar", AAR_VERSION);
    var OBJ_VERSION = "0.2.1";
    var OBJ_URL = string.Format("https://oss.sonatype.org/content/repositories/releases/de/javagl/obj/{0}/obj-{0}.jar", OBJ_VERSION);
    ~~~