mobfishgmbh / Cardboard-VR-Unity-SDK

Apache License 2.0
56 stars 11 forks source link

AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='setNewFileParent' #78

Open FenrirGameStudio opened 4 years ago

FenrirGameStudio commented 4 years ago

Hey Guys,

First of all thank you for the amazing work you've done, we managed to get our applications running on iOS in a very short amount of time, thanks to your work. However, on Android we've been having quite a few issues, most have been solvable, but currently we're facing the error seen below. Do you guys have any idea if this is coming from the protocol buffers, your solution or maybe a 3rd party library conflicting with something, such as Google Drive integration? Any advice would be greatly appreciated!

Our app runs fine until we booth up the VR scene at which point the screen turns black and then crashes with the following error being the root:

AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='setNewFileParent' signature='(Ljava/lang/String;)V' in class Ljava.lang.Object; java.lang.NoSuchMethodError: no static method with name='setNewFileParent' signature='(Ljava/lang/String;)V' in class Ljava.lang.Object; at com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source:167) at com.unity3d.player.UnityPlayer.nativeRender(Native Method) at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0) at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95) at android.os.Handler.dispatchMessage(Handler.java:108) at android.os.Looper.loop(Looper.java:216) at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20) at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngin

cdytoby commented 4 years ago

The file CardboardQrCode.cs is using this string setNewFileParent to access native android method, the c# method is called SetAndroidQRCodeLocation() in the same class and file.

NoSuchMethodError usually means the corresponding aar file is not included. Can you confirm that the sdk-debug.aar file in path Assets/Cardboard/Plugins/Android exist, and Android platform is selected in import settings?

FenrirGameStudio commented 4 years ago

Hey @cdytoby Thank you for getting back to me so quickly, I can indeed confirm that the sdk-debug.aar file is there and that the Android platform is selected in the import settings : )

But if I'm not mistaken, the error I'm encountering is caused by the QR scanning, in which case I should be able to solve my specific issue by excluding the QR scanning completely as I only need the VR part or am I mistaken?

(And also, really nice profile picture you got there! Huge Wakfu fan myself : P)

cdytoby commented 4 years ago

Well the whole native android things are packed together in this package, if it has issue with qr code scan then you'll probably encounter more issues elsewhere.

Can you confirm you're using this aar file exactly from this package instead of other source? Because I added this method myself in a branch of official sdk for some purposes. You can try override the file by copy this aar file from this repository again.

FenrirGameStudio commented 3 years ago

Sorry I never got back to you. After struggling with getting it to work, we changed our pipeline a bit and we're now running your solution for IPhone and another for Android Not exactly optimal, but that's how it goes : D Thank you for providing your solution : )