ARFoundation ImageTracking Sample scene doesnt generate image database

I'm trying to get the sample scene from the official github repo of ARFoundation 2.1 to work, but it doesnt generate the image database. The apk is working though and a camera feed can be seen on the display.

The error codes:

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:\Users\XXX\AppData\Local\Temp\4d676c83db4046c2bd0d68b010cd84ef\39344433fd8c4712b4ee109a5c73a2b2.txt:line 1: Invalid width specified: 0.
====
UnityEditor.XR.ARCore.ARCorePreprocessBuild.BuildImageTrackingAssets () (at Library/PackageCache/com.unity.xr.arcore@2.1.0-preview.4/Editor/ARCoreBuildProcessor.cs:279)
UnityEditor.XR.ARCore.ARCorePreprocessBuild.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at Library/PackageCache/com.unity.xr.arcore@2.1.0-preview.4/Editor/ARCoreBuildProcessor.cs:32)
UnityEditor.Build.BuildPipelineInterfaces+c_AnonStorey0.<>m_1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:376)
UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPairT1,T2 (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:356)
UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

I'm using Unity 2019.1.0f2 on Windows 7, all packages, sdk's etc should be installed. My target is a Samsung Galaxy Tab S4 with Android 9, although that shouldn't matter here.

Actually tried the same thing on a different PC with Windows 10 and Unity 2019.1.3f1, same problem. I guess I'm missing some packages? I'm really clueless.

(On a side note: Build and run doesnt work for me either with ARFoundation, but I guess that's another story on its own).

Does anyone have a solution for my problem? I'm tired of working on ARKit and ARCore simultanously and would really like to utilize ARFoundation. Thanks.

edit: attached a picture of my packege manager window.

4578535--426112--3qkUYOj01k.png

I use ARFoundation 2.10 with ARKit 2.10, iPhone XS, and I found that other ARFoundation features work correctly, but ARTrackedImageManager doesn't work. I tested it in both empty project and sample project on GitHub.

I guess we need to wait for a hotfix.

The issue has to do with how the image width is translated to a string. Depending on your region settings, it could be something like “0.25” or “0,25” (comma vs period). The ARCore image library generation tool expects a period. A fix is coming soon. In the meantime, you can try modifying the ReferenceImageLibrary to not specify widths for the images. (Note, this will only work on ARCore as ARKit requires widths for all images.)

Any hints on how to do that? Just ticking off "Specify size" on the image doesn't seem to help (Unity 2019.2b with ARCore 2.1 und AR Foundation 2.1), I am still getting the build error mentioned above when trying to build an apk.

What are the contents of C:\Users\XXX\AppData\Local\Temp\4d676c83db4046c2bd0d68b010cd84ef\39344433fd8c4712b4ee109a5c73a2b2.txt ?


I would gladly provide the contents of that .txt-file, but I cant find it in the given directory (even after building it again). I assume it's deleted or moved to another directory? Any pointers on how to save the error file in the building process? I couldn't find it in the documentation.

I changed some unity console settings: "stack trace logging --> error" from "script only" to "full", which returned a different error for the first error message. Don't think it will be particularily useful, but I guess it won't hurt to post it.

Failed to generated ARCore reference image library 'ReferenceImageLibrary'
0x00000001422E93CC (Unity) StackWalker::GetCurrentCallstack
0x00000001422EC881 (Unity) StackWalker::ShowCallstack
0x0000000140A58695 (Unity) GetStacktrace
0x0000000142D06C60 (Unity) DebugStringToFile
0x0000000142317EC9 (Unity) DebugLogHandler_CUSTOM_Internal_Log
0x000000004017FE8B (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
0x000000004017FD4B (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
0x000000004017F702 (Mono JIT Code) [Logger.cs:127] UnityEngine.Logger:LogFormat (UnityEngine.LogType,string,object[])
0x000000004017F432 (Mono JIT Code) [Debug.bindings.cs:135] UnityEngine.Debug:LogErrorFormat (string,object[])
0x000000004011DA63 (Mono JIT Code) [ARCoreBuildProcessor.cs:267] UnityEditor.XR.ARCore.ARCorePreprocessBuild:BuildImageTrackingAssets ()
0x000000004011882B (Mono JIT Code) [ARCoreBuildProcessor.cs:32] UnityEditor.XR.ARCore.ARCorePreprocessBuild:OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport)
0x00000000401184EF (Mono JIT Code) [BuildPipelineInterfaces.cs:376] UnityEditor.Build.BuildPipelineInterfaces/<OnBuildPreProcess>c__AnonStorey0:<>m__1 (UnityEditor.Build.IPreprocessBuildWithReport)
0x0000000040118082 (Mono JIT Code) [BuildPipelineInterfaces.cs:356] UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair<T1_REF, T2_REF> (System.Collections.Generic.List`1<T1_REF>,System.Action`1<T1_REF>,System.Collections.Generic.List`1<T2_REF>,System.Action`1<T2_REF>,bool)
0x0000000040116FAB (Mono JIT Code) [BuildPipelineInterfaces.cs:374] UnityEditor.Build.BuildPipelineInterfaces:OnBuildPreProcess (UnityEditor.Build.Reporting.BuildReport)
0x000000002CB8AAFB (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_object (object,intptr,intptr,intptr)
0x000007FEC964BBCB (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
0x000007FEC95D2252 (mono-2.0-bdwgc) [object.c:2919] do_runtime_invoke
0x000007FEC95DB25F (mono-2.0-bdwgc) [object.c:2966] mono_runtime_invoke
0x000000014227B036 (Unity) scripting_method_invoke
0x0000000142275335 (Unity) ScriptingInvocation::Invoke
0x0000000142270585 (Unity) ScriptingInvocation::Invoke<void>
0x000000013F9FE459 (Unity) Scripting::UnityEditor::Build::BuildPipelineInterfacesProxy::OnBuildPreProcess
0x00000001403E510D (Unity) BuildPlayer
0x00000001412E31DE (Unity) BuildPipeline::BuildPlayerInternalNoCheck
0x00000001412E11D3 (Unity) BuildPipeline_CUSTOM_BuildPlayerInternalNoCheck
0x0000000040031E43 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,UnityEditor.BuildOptions,bool)
0x0000000040031283 (Mono JIT Code) [BuildPlayerWindowBuildMethods.cs:173] UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)
0x000000003FFC7CDB (Mono JIT Code) [BuildPlayerWindowBuildMethods.cs:98] UnityEditor.BuildPlayerWindow:CallBuildMethods (bool,UnityEditor.BuildOptions)
0x000000003FA68F33 (Mono JIT Code) [BuildPlayerWindow.cs:908] UnityEditor.BuildPlayerWindow:GUIBuildButtons (UnityEditor.Modules.IBuildWindowExtension,bool,bool,bool,UnityEditor.Build.BuildPlatform)
0x00000000435AB2EB (Mono JIT Code) [BuildPlayerWindow.cs:799] UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings ()
0x000000004358F803 (Mono JIT Code) [BuildPlayerWindow.cs:367] UnityEditor.BuildPlayerWindow:OnGUI ()
0x0000000031B75670 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x000007FEC964BBCB (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
0x000007FEC95D2252 (mono-2.0-bdwgc) [object.c:2919] do_runtime_invoke
0x000007FEC95DB432 (mono-2.0-bdwgc) [object.c:3071] mono_runtime_invoke_checked
0x000007FEC95DBBC9 (mono-2.0-bdwgc) [object.c:5262] mono_runtime_try_invoke_array
0x000007FEC95DB3C6 (mono-2.0-bdwgc) [object.c:5140] mono_runtime_invoke_array_checked
0x000007FEC9580254 (mono-2.0-bdwgc) [icall.c:3358] ves_icall_InternalInvoke
0x000000003B181F56 (Mono JIT Code) (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
0x000000003B18055B (Mono JIT Code) System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
0x000000001A5C0A1F (Mono JIT Code) System.Reflection.MethodBase:Invoke (object,object[])
0x0000000036335803 (Mono JIT Code) [HostView.cs:345] UnityEditor.HostView:Invoke (string,object)
0x0000000036335663 (Mono JIT Code) [HostView.cs:340] UnityEditor.HostView:Invoke (string)
0x000000004358D6E3 (Mono JIT Code) [HostView.cs:140] UnityEditor.HostView:OldOnGUI ()
0x0000000010F53071 (Mono JIT Code) [IMGUIContainer.cs:278] UnityEngine.UIElements.IMGUIContainer:smile:oOnGUI (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,bool,UnityEngine.Rect)
0x0000000010F5108B (Mono JIT Code) [IMGUIContainer.cs:483] UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect)
0x000000004357CAC3 (Mono JIT Code) [IMGUIContainer.cs:464] UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event)
0x0000000036314FD3 (Mono JIT Code) [IMGUIContainer.cs:444] UnityEngine.UIElements.IMGUIContainer:HandleEvent (UnityEngine.UIElements.EventBase)
0x0000000043576104 (Mono JIT Code) [MouseCaptureDispatchingStrategy.cs:89] UnityEngine.UIElements.MouseCaptureDispatchingStrategy:smile:ispatchEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel)
0x000000003627A4A7 (Mono JIT Code) [EventDispatcher.cs:282] UnityEngine.UIElements.EventDispatcher:ProcessEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel)
0x0000000036273AEB (Mono JIT Code) [EventDispatcher.cs:157] UnityEngine.UIElements.EventDispatcher:smile:ispatch (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel,UnityEngine.UIElements.DispatchMode)
0x0000000036273713 (Mono JIT Code) [Panel.cs:190] UnityEngine.UIElements.BaseVisualElementPanel:SendEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.DispatchMode)
0x000000003C36E963 (Mono JIT Code) [UIElementsUtility.cs:258] UnityEngine.UIElements.UIElementsUtility:smile:oDispatch (UnityEngine.UIElements.BaseVisualElementPanel)
0x000000003C36E0CB (Mono JIT Code) [UIElementsUtility.cs:78] UnityEngine.UIElements.UIElementsUtility:ProcessEvent (int,intptr)
0x000000003C36DA34 (Mono JIT Code) [GUIUtility.cs:179] UnityEngine.GUIUtility:ProcessEvent (int,intptr)
0x000000003C36DC53 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_bool_int_intptr (object,intptr,intptr,intptr)
0x000007FEC964BBCB (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
0x000007FEC95D2252 (mono-2.0-bdwgc) [object.c:2919] do_runtime_invoke
0x000007FEC95DB25F (mono-2.0-bdwgc) [object.c:2966] mono_runtime_invoke
0x000000014227B036 (Unity) scripting_method_invoke
0x0000000142275335 (Unity) ScriptingInvocation::Invoke
0x00000001422705AA (Unity) ScriptingInvocation::Invoke<bool>
0x000000013FA01C79 (Unity) Scripting::UnityEngine::GUIUtilityProxy::ProcessEvent
0x00000001409015EC (Unity) GUIView::ProcessRetainedMode
0x0000000140D64B6D (Unity) GUIView::OnInputEvent
0x00000001409014FC (Unity) GUIView::ProcessInputEvent
0x0000000140D66655 (Unity) GUIView::ProcessEventMessages
0x0000000140D5FC44 (Unity) GUIView::GUIViewWndProc
0x0000000076BC9BBD (USER32) TranslateMessageEx
0x0000000076BC98C2 (USER32) TranslateMessage
0x0000000140D63AEC (Unity) MainMessageLoop
0x0000000140D6D347 (Unity) WinMain
0x000000014369DD8E (Unity) __scrt_common_main_seh
0x0000000076CC556D (kernel32) BaseThreadInitThunk
0x0000000076E2385D (ntdll) RtlUserThreadStart

I'm also trying to get the image tracking to work on iOS but no luck yet. Using Unity 2019.2b04 and the latest ARFoundation samples. Everything else works fine.

Any hints @tdmowrer or @I_Jemin_1 ?

@tdmowrer Would really appreciate some help here.

If you get the same error code as me, would it be possible for you to provide the desired .txt-file (in my case: C:\Users\XXX\AppData\Local\Temp\4d676c83db4046c2bd0d68b010cd84ef\39344433fd8c4712b4ee109a5c73a2b2.txt) ?

Apparently he misses some information to help us with that issue.

@PTW_AR I'm on iOS and I get no error at all. It simply doesn't recognize any images.

@luispedrofonseca @hendrik_unity793 ARFoundation 2.2 (the one with the ARKit 3.0 Update) solved the issue for me.

What version XCode are you using?

I can not compile project in XCode 10.2, after update ARfoundation to 2.2.0 version and ARkit 2.2 version, in my project I use only 2D image Tracking, Is there any solution to this problem?4628470--433921--upload_2019-6-9_15-23-14.png

I don’t think that’s the right place for your problem. Anyway, I will give it a try:

You will need iOS 13 and XCode 11 in order to get it onto your iOS-device. I’m working with a Android device right now, so I haven’t used XCode yet.

the solution to my problem is update ARfoundation to 2.2.0 but do not update ARkit XR 2.2.0, I did downgrade to ARKit to 2.1.0 and after that everything worked!

Also doesn't work if .PNG extension is in CAPS. Changes to lowercase and now it seems to build.

For ARCore or ARKit or both?

Edit: I tested building both ARCore and ARKit from a Mac and they both complain that .PNG is not a valid extension. ARKit still recognizes the image at runtime, so it appears safe to ignore the Xcode warning. ARCore, however, will not generate the image database at all. I see what we can do in ARFoundation to work around this limitation.

1 Like

Apologies; I missed your plea for help. If you’re still having issues, please let me know the exact version of Unity, ARFoundation package, ARKit XR Plugin package, iOS, and Xcode.

1 Like

Make sure your image target is at least 300 x 300 pixels. The file extension should be .png preferably. If it is .jpeg avoid heavy compression for best performance.

1 Like


This worked for me on ARFoundation 3.1.0