Log in or register to post comments

AndroidJavaException: java.lang.ClassNotFoundException: com.vuforia.VuforiaUnityPlayer.VuforiaInitializer ERROR

February 22, 2018 - 2:19am #1

Hi.

I'm integrating a Unity Scene(with Vuforia) into Android Studio and I'm having the following error:

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

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:101)

             at android.os.Looper.loop(Looper.java:156)

             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/com.example.andoni.vumarksapplication-2/base.apk", zip file "/data/app/com.example.andoni.vumarksapplication-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.andoni.vumarksapplica

E/mono: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object

          at UnityEngine.AndroidJavaObject.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0

          at UnityEngine.AndroidJavaObject.Finalize () [0x00000] in <filename unknown>:0

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:101)

             at android.os.Looper.loop(Looper.java:156)

             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/com.example.andoni.vumarksapplication-2/base.apk", zip

E/mono: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object

          at UnityEngine.AndroidJavaObject.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0

          at UnityEngine.AndroidJavaObject.Finalize () [0x00000] in <filename unknown>:0

E/Unity: Vuforia cannot be started before it is initialized.

          Please disable Delayed Initializationin the Vuforia configuration or initialize Vuforia manually with the VuforiaRuntime-class.

        

         (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

To export the Unity Scene I followed this tutorials: 

https://medium.com/@davidbeloosesky/embedded-unity-within-android-app-7061f4f473a 

https://developer.vuforia.com/forum/android/using-android-studio-vuforia

 

Specifications:

Android Studio 3.0.1

Unity 2017.3.0f3

Vuforia 7

Android SDK API 26

 

Has someone experienced this issue before? Can anyone provide a solution?

 

Thanks in advance. 

AndroidJavaException: java.lang.ClassNotFoundException: com.vuforia.VuforiaUnityPlayer.VuforiaInitializer ERROR

March 14, 2018 - 12:17am #5

Hi!

For me, this didn't work. I ended up in importing the module into my project (not only the aar). The app wouldn't find the vuforia wrapper so I moved the line 

implementation(name: 'VuforiaWrapper', ext: 'aar')

from the module build.gradle to the app build.gradle. I also moved the VuforiaWrapper.aar file from the modules/lib to the app/lib folder. Now the app runs fine. Probably not the nicest solution but it solved my problems.

Best regards

 

AndroidJavaException: java.lang.ClassNotFoundException: com.vuforia.VuforiaUnityPlayer.VuforiaInitializer ERROR

March 6, 2018 - 8:25am #4

Hey! 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

AndroidJavaException: java.lang.ClassNotFoundException: com.vuforia.VuforiaUnityPlayer.VuforiaInitializer ERROR

March 2, 2018 - 12:54am #3

Hello Strasza

 

I have downloaded the native Android SDK from the link and imported into my project as a library and also i have seen the Vuforia samples and take the idea of how to initialize vuforia, and all its going on well. But, when I load into the scene of Vuforia Unity the error I have posted persist. What can I do to solve it? I have to Initialize Vuforia on the Vuforia Unity project I have on Android Studio instead of on the main Android Studio project?

 

P.S: I still have the Vuforia Unity scene imported on my android studio project as a Library. See the following images.

https://pasteboard.co/Ha0G1Gs.png

https://pasteboard.co/Ha0HD3p.png

Edit:

 

I have notice is not a problem of initializing Vuforia, reading well is the key to understanding the problem correctly. Basically I have to make a login and a pair of Android activities, and then when i click on the last activity of android i have to go to a Vuforia Unity Scene, and there is where am having the problem.

AndroidJavaException: java.lang.ClassNotFoundException: com.vuforia.VuforiaUnityPlayer.VuforiaInitializer ERROR

February 22, 2018 - 11:29am #2

Hello aTruji,

Importing a Vuforia Unity scene into an Android Studio project is not a supported workflow. The forum post you link in your post is an older thread about getting the Native Android SDK working in Android Studio.

If you intend to use Android Studio, it is recommended that you use the native Android SDK which can be downloaded here: https://developer.vuforia.com/downloads/sdk

Thanks,

Vuforia Support

Log in or register to post comments