Hello,
I just downloaded the samples project and switched the platform to Android and tried to build the Image Tracking scene, but I get these errors:
Failed to generated ARCore reference image library 'ReferenceImageLibrary'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
BuildFailedException: Failed to generate image database. Output from arcoreimg:
stdout:
====
stderr:
C:/Unity.imgdb: Failed to open file.
====
UnityEditor.XR.ARCore.ARCorePreprocessBuild.BuildImageTrackingAssets () (at Library/PackageCache/[email protected]/Editor/ARCoreBuildProcessor.cs:279)
UnityEditor.XR.ARCore.ARCorePreprocessBuild.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at Library/PackageCache/[email protected]/Editor/ARCoreBuildProcessor.cs:32)
UnityEditor.Build.BuildPipelineInterfaces+<OnBuildPreProcess>c__AnonStorey0.<>m__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:376)
UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:356)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
AR Foundation Version: 2.1.0
Unity : 2019.1.1f1
ARCore XR Plugin Version 2.1.0
Same problem here.
Same problem. And I have tried both 2019.1.2f1 and 2019.2.0b2
same. Using...
AR Foundation Version: 2.1.0 preview.2
Unity : 2019.1.3f1
ARCore XR Plugin Version 2.1.0 preview.4
I managed to get around this by deleting the Image database inside Scenes/ImageTracking/Images.
For me it was due to the culture setting of my machine. For floats it was using comma's instead of periods when creating the input/width for arcoreimg. It looks like arcoreimg only accepts periods.
Change line 193 in ARCoreBuildProcessor.cs to
writer.WriteLine(entry.ToString().Replace(",","."));
Not the pretiest but it works! Using Unity 2019.1.3f1.
@Curbsider, thank you for sharing. However that suggestion did not fix the issue for me.
Duplicating ReferenceImageLibrary and assigning the new one worked for me. Unity 2018.3.12
Same issue here. Unfortunately none of the suggested workaround fixed it for me :(
The error in my side was having spaces in the directories between the name of the project, the subdirectories and the path where I put the images.
It seems like a bug of arcoreimg.exe in windows, or maybe how the script is creating the temp paths.
OS: Windows 10 64 bits.
Unity3D version: 2019.1.2f1
I'm using a Mac. After I took the project file and placed it on my desktop and did an Android build, I did not get an error. I have spaces in the names of some of my folders that contain the project, so it does appear the issue is rooted in spaces.
We've reproduced two issues reported here:
arcoreimg. The image width gets converted to a string which, depending on your region, might produce a string with a comma instead of a period. E.g., 0,25 instead of 0.25.Those are easy fixes, and we'll release an updated package shortly. Please let me know if there are any other issues.
Thank you for the suggestions and fixes!
In may case it was the spaces in the project path, I removed all spaces from the path and now it's building correctly.
In may case it was the spaces in the project path, I removed all spaces from the path and now it's building correctly.
Sorry.... but can you explane me where the project path is ?
I can't resolve this issue..
Thank you
@flogli the file path. Mac OS example: Computer/Users/UserName/Desktop/My AR Unity Project/
The spaces in the folder called "My AR Unity Project" cause this issue. Remove them or move your project. Tim said a fix is on the way.
Got this error as well. Tried all of this fixes but kept having the same error.
Weirdly it was failing only with one image, if I added other images worked just fine, all of them with no spaces on the path/name. The image that was failing with was the smallest one, could be a size related thing as well ?. Here are attached the images if you guys need to debug it:
Failing image:

Working image:

If there could be a set of explained solutions provided, that would be nice. There are no spaces in my project path and I still received this issue. I even removed all spaces from the image names in the library.
Also edited the line of code in ARCoreBuildProcessor as suggested above, even though this shouldn't be a problem anymore (using AR Foundation 3.0.0 preview.3).
Neither of these solutions worked.
It finally took deleting and re-creating the Reference Image Library, then using a different sized image. Although so far what size is required is unknown and arbitrary.
Despite this issue being closed, finding the solution is still guesswork, that's not good.
I encountered the same problem锛寃hen i switch my image format from png to jpg everything is ok
i was having the same problem...almost tried every solution...and found that there is no problem in the script..the problem was with the image....and the solution was to use high resolution image and it worked for me.
The Solution for this is:
AR Foundation Image Library doesn't detect PNG transparent images.
As the image is converted into string format the transparent data in an image is converted into ','
The image can only have period string in it.
That's the reason it fails to build the image library and then giving a build error.
Do give it a try by removing transparency from a png image.
Regards.
AR Foundation Image Library doesn't detect PNG transparent images.
As the image is converted into string format the transparent data in an image is converted into ','
The image can only have period string in it.
Where are you seeing the image encoded into a string?
Same solution worked for me -> convert .png to .jpg and voila it worked.
Thanks to all who suggested that.
It's happened due to the low-quality score of the image. ARCore reference image library accepts images of type .png and .jpg only. Also, It shows to have a quality score.
First, we have to check the quality score of the image using arcoreimg tool
We can download it from arcoreimg
Refer the following link to check the quality score click here
If the quality score is greater than 10 then you can create a database using that image
otherwise, try another one.
I had the same problem. Turns out the images I were using didn't have enough points to recognize. I hope this helps someone.
I got this Error on Version 2020.01.10f1 and tested another Project. There it worked. It was my Image i chosen for the Libary. I think it was to bad for Image Tracking. It had just one form and one color. It worked with detailed images.
Tried with numerous different images but no luck, assumed images clicked from iphone 11 max pro would obviously qualify but no luck.
We've reproduced two issues reported here:
- Region settings affect the input file we generate for
arcoreimg. The image width gets converted to a string which, depending on your region, might produce a string with a comma instead of a period. E.g.,0,25instead of0.25.- Spaces in the project pathname are not handled correctly.
Those are easy fixes, and we'll release an updated package shortly. Please let me know if there are any other issues.
Where to change the region setting ?
Most helpful comment
It's happened due to the low-quality score of the image. ARCore reference image library accepts images of type .png and .jpg only. Also, It shows to have a quality score.
First, we have to check the quality score of the image using arcoreimg tool
We can download it from arcoreimg
Refer the following link to check the quality score click here
If the quality score is greater than 10 then you can create a database using that image
otherwise, try another one.
ARFoundation Reference Image Library Demo