Start a new topic

Error while trying to register a Plugin

Hello,

I am using your Marker Tracking plugin example from the Wikitude SDK For Android 8.9.0 JavaScript to display a 3d object in the AR Scene.

I have contacted you several weeks ago for the same matter and you gave me clarifications as to how to properly register a Plugin with the method registerNativePlugins() in Java. 

My problem is that, when the Activity runs this method, I get the errors specified in the .txt file that I am sharing.

Have you encountered such errors before? Please have a look.

Thank you in advance.

txt
(3.2 KB)

Hi Nikolas,



my apologies for the delayed answer, I was on sick leave off and on for the last couple of days.


Are these the exact files you are using? Have you considered the following segment of the build.gradle file?


/* To rebuild the plugins this has to be set to true. Otherwise the prebuilt plugins library will be used.
 * This is only for the purpose of providing the Example App without the requirement of installing the Android NDK.
 */
def rebuildPlugins = false


Could the issue be caused by the plugins simply not being re-compiled?



- Daniel

Hi,



this error log is not very descriptive, it simply shows that an address that should not have been accessed was. Could you run me through the exact steps you've taken so far? When does this crash occur exactly (which line of code)?



- Daniel

Hello Daniel,

From the example plugins that you provide in the wikitudeSDK 8.9.0 I used the marker_tracking example along with JniHelper.cpp, JniHelper.h, JniRegistration.cpp files, the include folder in which all useful header files for the corresponding libraries reside and I specified them in the CMakeLists.txt file for compilation and linking with the Android Studio Gradle files in order for the C++ native code to run properly through my application.

I took all the steps provided in your documentation to do that.


This crash occurs in my Activity that I call the registerNativePlugins method.

I am sending you:

- The CMakeLists.txt file in which I specify the libraries and the .cpp components I use.
- The build.gradle file of my app.
- The Activity in which the error occurs.

- The JniRegistration.cpp

- The MarkerTrackerPlugin.cpp file that is the  c++ plugin that I register to Java.

Also, I have noticed something in the JniRegistration.cpp file that might be of importance.
The function that the file calls is not used anywhere. Since JNI is the bridge used for C++ to call Java native methods, maybe this is the thing that causes the error I am facing.

java
(3.95 KB)
cpp
cpp
(964 Bytes)
txt
(2.98 KB)

Hello Daniel,

Unfortunately def rebuildPlugins = false doesn't change a thing.

I actually found what was causing the error and it was the function of the JNI interface that was never used (in JniRegistration.cpp). According to your documentation, the JniRegistration.cpp calls the native method private native long[] createNativePlugins(String var1);

from the class PluginManagerInternal in the package com.wikitude.common.plugins.internal (from the wikitude library). While the method seems to be connecting with the JNIRegistration.cpp and used properly there, in the JniRegistration.cpp says that is never been used.

So, now I created the createNativePlugins() method in the my ARActivity and I call it right after the registerNativePlugins(). I know it's silly, but this stops the error I was facing.

I have another error now, in the line of the 
registerNativePlugins() :


No implementation found for long[] com.wikitude.common.plugins.internal.PluginManagerInternal.createNativePlugins(java.lang.String)


Which means that when registerNativePlugins() is called, it's still looking for the native method in the PluginManagerInternal class that was not being used by JNI in the first place.


Please help me get out of this loop.


Login or Signup to post a comment