androidandroid-ndkazure-spatial-anchors

Azure SpatialAnchors AppProperties crash in Android NDK


Azure SpatialAnchors NDK crashes on inserting/looking up AppProperties. After unsuccessful attempts to fix it in my custom app I added the code to the official Microsoft tutorial which builds and works fine.

https://github.com/Azure/azure-spatial-anchors-samples/blob/master/Android/NDK/app/src/main/cpp/AzureSpatialAnchorsApplication.cpp#L570

visual.cloudAnchor = std::make_shared<CloudSpatialAnchor>();
visual.cloudAnchor->LocalAnchor(visual.localAnchor);
std::shared_ptr<IMap<std::string, std::string>> properties = visual.cloudAnchor->AppProperties(); // new code
// verified properties is not null
properties->Insert(R"(model-type)", R"(frame)");       // crash!
ERROR: A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 22056

Here is the documentation which shows how to set app properties https://learn.microsoft.com/en-us/azure/spatial-anchors/how-tos/create-locate-anchors-cpp-ndk


Solution

  • Thank you for reaching out!

    This is a duplicate of this GitHub issue The team will follow up there