Android Studio - ARCore - E/DynamiteClient:无法从远程包加载本机库 [packageName=com.google.ar.core,libraryName=arcore_c]:

Android Studio - ARCore - E/DynamiteClient: Failed to load native library [packageName=com.google.ar.core,libraryName=arcore_c] from remote package:

我正在尝试遵循 Android ARCore tutorial,但是当我尝试启动应用程序时,我一直收到此错误:

E/DynamiteClient: Failed to load native library [packageName=com.google.ar.core,libraryName=arcore_c] from remote package:

    java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.google.ar.core-dmlqkWErgZyoM0RLfsTjSw==/lib/arm/libarcore_c.so" has unexpected e_machine: 40 (EM_ARM)
        at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
        at java.lang.System.loadLibrary(System.java:1669)
        at com.google.vr.dynamite.NativeLibraryLoader.a(PG:30)
        at com.google.vr.dynamite.NativeLibraryLoader.initializeAndLoadNativeLibrary(PG:14)
        at evx.a(PG:7)
        at xo.onTransact(PG:5)
        at android.os.Binder.transact(Binder.java:667)
        at com.google.a.a.b.transactAndReadException(BaseProxy.java:10)
        at com.google.vr.dynamite.client.b.initializeAndLoadNativeLibrary(INativeLibraryLoader.java:5)
        at com.google.vr.dynamite.client.DynamiteClient.loadNativeRemoteLibrary(DynamiteClient.java:26)
        at com.google.ar.core.Session.nativeCreateSessionAndWrapperWithFeatures(Native Method)
        at com.google.ar.core.Session.<init>(Session.java:14)
        at com.google.ar.sceneform.ux.BaseArFragment.createSessionWithFeatures(BaseArFragment.java:419)
        at com.google.ar.sceneform.ux.BaseArFragment.createSession(BaseArFragment.java:405)
        at com.google.ar.sceneform.ux.BaseArFragment.initializeSession(BaseArFragment.java:379)
        at com.google.ar.sceneform.ux.BaseArFragment.onResume(BaseArFragment.java:338)
        at androidx.fragment.app.Fragment.performResume(Fragment.java:2649)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:922)
        at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
        at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2659)
        at androidx.fragment.app.FragmentManagerImpl.dispatchResume(FragmentManagerImpl.java:2625)
        at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:268)
        at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:479)
        at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:468)
        at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:195)
        at android.app.Activity.performResume(Activity.java:7317)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3776)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3816)
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/third_party/arcore/java/com/google/vr/dynamite/client/native/dynamite_client.cc: Dynamite::LoadNativeRemoteLibrary handle=0
E/third_party/arcore/ar/core/android/sdk/session_create.cc: Dynamite failed to load remote library
    LoadSymbolsDynamite returning AR_ERROR_FATAL.
    LoadSymbols returning status.
E/StandardArFragment: Error: Failed to create AR session
    com.google.ar.core.exceptions.UnavailableException
        at com.google.ar.sceneform.ux.BaseArFragment.initializeSession(BaseArFragment.java:391)
        at com.google.ar.sceneform.ux.BaseArFragment.onResume(BaseArFragment.java:338)
        at androidx.fragment.app.Fragment.performResume(Fragment.java:2649)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:922)
        at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
        at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2659)
        at androidx.fragment.app.FragmentManagerImpl.dispatchResume(FragmentManagerImpl.java:2625)
        at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:268)
        at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:479)
        at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:468)
        at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:195)
        at android.app.Activity.performResume(Activity.java:7317)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3776)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3816)
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: com.google.ar.core.exceptions.FatalException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
        at com.google.ar.core.Session.throwExceptionFromArStatus(Session.java:143)
        at com.google.ar.core.Session.nativeCreateSessionAndWrapperWithFeatures(Native Method)
        at com.google.ar.core.Session.<init>(Session.java:14)
        at com.google.ar.sceneform.ux.BaseArFragment.createSessionWithFeatures(BaseArFragment.java:419)
        at com.google.ar.sceneform.ux.BaseArFragment.createSession(BaseArFragment.java:405)
        at com.google.ar.sceneform.ux.BaseArFragment.initializeSession(BaseArFragment.java:379)
        at com.google.ar.sceneform.ux.BaseArFragment.onResume(BaseArFragment.java:338) 
        at androidx.fragment.app.Fragment.performResume(Fragment.java:2649) 
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:922) 
        at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238) 
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303) 
        at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2659) 
        at androidx.fragment.app.FragmentManagerImpl.dispatchResume(FragmentManagerImpl.java:2625) 
        at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:268) 
        at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:479) 
        at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:468) 
        at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:195) 
        at android.app.Activity.performResume(Activity.java:7317) 
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3776) 
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3816) 
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51) 
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 

我不太清楚为什么会收到此错误。我重新检查了我的代码,它包含教程中的所有内容。我已经对有关错误的文档进行了大量搜索,但没有找到有关如何解决它的任何答案。

这是我的代码:

清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.arcoretestjava">

    <!-- "AR Required" apps must declare minSdkVersion >= 24. -->
    <uses-sdk android:targetSdkVersion="29"/>

    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-feature android:name="android.hardware.camera.ar" android:required="true"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <meta-data android:name="com.google.ar.core" android:value="required"/>

    </application>
</manifest>

build.gradle(应用程序)

    implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.15.0'
    implementation 'com.google.ar:core:1.16.0

从那里可以看出您是 运行在 Intel 而不是 ARM 设备上安装应用程序的错误 - 不同的硬件通常需要不同的库文件。

如果您运行在模拟器中安装应用程序,则 ARCore 说明提供了有关为模拟器设置 x86 支持的信息 (https://developers.google.com/ar/develop/java/emulator):

Get Android Studio and SDK tools for ARCore

Install Android Studio 3.1 or later.

In Android Studio, go to Preferences > Appearance and Behavior > System Settings > Android SDK.

Select the SDK Platforms tab and check Show Package Details.

Under Android 8.1 (Oreo), select:

Google APIs Intel x86 Atom System Image API Level 27, version 4 or later.

Select the SDK Tools tab and add Android Emulator 27.2.9 or later.

Click OK to install the selected pacakges and tools.

Click OK again to confirm changes.

Accept the license agreement for the Component Installer.

Click Finish.

如果您的应用还包含 NDK 组件,请查看关于需要 x86 API 的说明,与上面相同 link 作为检查,但我认为这不适用于你现在的情况。

如果出于某种原因您需要在 x86b 上 运行 并且没有您需要的某些二进制文件的 x86 版本,则有一个名为 libhoundi 的库可以帮助实现这一点。这里有一个很好的概述:https://commonsware.com/blog/2013/11/21/libhoudini-what-it-means-for-developers.html

同样,我认为这不适用于您的情况,但作为背景知识可能会有用。