Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.7k views
in Technique[技术] by (71.8m points)

unity3d - Azure spatial anchors error on unity android : azurespatialanchorsndk not found

I am trying to use azure spatial anchors with the unity android app. However, I am always getting the error mentioned below when try to run on unity.

DllNotFoundException: azurespatialanchorsndk 
Microsoft.Azure.SpatialAnchors.CloudSpatialAnchorSession..ctor () (at Library/PackageCache/com.microsoft.azure.spatial-anchors-sdk.android@2.7.0/Runtime/AzureSpatialAnchorsBridge_Android.cs:2056) AzureSpatialAnchor.CreateAzureSession () (at Assets/Scripts/AzureSpatialAnchor.cs:82) 
AzureSpatialAnchor.Awake () (at Assets/Scripts/AzureSpatialAnchor.cs:58)

Also, when I try to deploy the app on android, the app always crashes with azure spatial ancors functionality. Below are the logs from android logcat

2021/01/21 19:51:59.359 13344 18592 Info multiplayerdem Thread[17,tid=18592,Native,Thread*=0xcf456800,peer=0x12d406f8,"UnityMain"] recursive attempt to load library "/data/app/com.DefaultCompany.armultiplayerdemo-p-urYsoMMitWiE2Z6JXUqg==/base.apk!/lib/armeabi-v7a/libazurespatialanchorsndk.so" 
2021/01/21 19:51:59.404 13344 18592 Error CRASH #01 Microsoft.Azure.SpatialAnchors.CloudSpatialAnchorSession:Start () <C:Users
ash8327Desktopar-multiplayer-demoLibraryPackageCachecom.microsoft.azure.spatial-anchors-sdk.android@2.7.0RuntimeAzureSpatialAnchorsBridge_Android.cs:2593>

Below is my mainTemplate.gradle file that I have used for the build

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        // Must be Android Gradle Plugin 3.6.0 or later. For a list of
        // compatible Gradle versions refer to:
        // https://developer.android.com/studio/releases/gradle-plugin
        classpath 'com.android.tools.build:gradle:3.6.0'
    }
}

allprojects {
   repositories {
      google()
      jcenter()
      flatDir {
        dirs 'libs'
      }
   }
}

apply plugin: 'com.android.library'
**APPLY_PLUGINS**

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation('com.squareup.okhttp3:okhttp:[3.11.0]')
    implementation('com.microsoft.appcenter:appcenter-analytics:[1.10.0]')
**DEPS**
    // Azure Spatial Anchors
    //implementation ("com.microsoft.azure.spatialanchors:spatialanchors_ndk:[2.7.0]") {
    //    exclude group: 'com.google.ar'
    //}
    //natives "com.microsoft.azure.spatialanchors:spatialanchors_ndk:[2.7.0]"
}

android {
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
        consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**PACKAGING_OPTIONS**
}**REPOSITORIES****SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**

I have tried everything but this error does not resolve.

------- Versions--------

  1. Unity : 2019.4.15f1
  2. AR Foundation : 4.1.1 3. AR Subsystems : 4.1.1
  3. ARCore XR Plugin: 4.1.1
  4. Azure Spatial Anchor : 2.7.0

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...