Importing Vufoira Scene into native android app

我的未来我决定 提交于 2019-12-23 19:22:43

问题


I am working on AR app made with unity + vufoira and I wanted to embed it in a native android app. I used this procedures to embed my app Embedding Unity In Android App . But I keep having the following error.

03-04 07:22:24.160 12649-13939/yenettaapp.beblocky E/Unity: AndroidJavaException: java.lang.ClassNotFoundException: com.vuforia.VuforiaUnityPlayer.VuforiaInitializer java.lang.ClassNotFoundException: com.vuforia.VuforiaUnityPlayer.VuforiaInitializer at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:400) at java.lang.Class.forName(Class.java:326) at com.unity3d.player.UnityPlayer.nativeRender(Native Method) at com.unity3d.player.UnityPlayer.c(Unknown Source) at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:154) at com.unity3d.player.UnityPlayer$c.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.vuforia.VuforiaUnityPlayer.VuforiaInitializer" on path: DexPathList[[zip file "/data/app/yenettaapp.beblocky-1/base.apk", zip file "/data/app/yenettaapp.beblocky-1/split_lib_dependencies_apk.apk", zip file "/data/app/yenettaapp.beblocky-1/split_lib_slice_0_apk.apk", zip file "/data/app/ 03-04 07:22:24.205 12649-13939/yenettaapp.beblocky E/Unity: Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.vuforia.VuforiaUnityPlayer.VuforiaInitializer java.lang.ClassNotFoundException: com.vuforia.VuforiaUnityPlayer.VuforiaInitializer at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:400) at java.lang.Class.forName(Class.java:326) at com.unity3d.player.UnityPlayer.nativeRender(Native Method) at com.unity3d.player.UnityPlayer.c(Unknown Source) at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:154) at com.unity3d.player.UnityPlayer$c.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.vuforia.VuforiaUnityPlayer.VuforiaInitializer" on path: DexPathList[[zip file "/data/app/yenettaapp.beblocky-1/base.apk", zip file "/data/app/ye 03-04 07:22:24.229 12649-14048/yenettaapp.beblocky E/mono: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at UnityEngine.AndroidJavaObject.Dispose (Boolean disposing) [0x00000] in :0 at UnityEngine.AndroidJavaObject.Finalize () [0x00000] in :0 03-04 07:22:24.229 12649-14048/yenettaapp.beblocky E/mono: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at UnityEngine.AndroidJavaObject.Dispose (Boolean disposing) [0x00000] in :0 at UnityEngine.AndroidJavaObject.Finalize () [0x00000] in :0

How can I get around this error ?


回答1:


I had the same problem. This is how I fixed it:

  • In the project build.gradle I added this under allprojects repositories:
   flatDir {
            dirs 'libs'
        }
  • In my module build.gradle I added the dependencies:
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation(name: 'VuforiaWrapper', ext:'aar'

Hope this may help you




回答2:


I have also tried that Embedding Unity In Android App tutorial from Medium and it didn't work.

Try this Unity3d tutorial -Export Unity Project to Android Studio.

  1. First in Unity Build Settings, make sure you choose Gradle for Build System, Export Project, Development Build and Script Debugging.

  1. Also, make sure you change the Gradle dependency version in Android Studio.

Here is a similar question from Quora.



来源:https://stackoverflow.com/questions/49106942/importing-vufoira-scene-into-native-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!