Start a new topic

Native rendering crashes on Android


I am facing issue when using both External and Internal rendering modes with Android Native SDK. Issue is 99% reproducable on emulator. On a physical device (running API 24) it is much less likely to happen but still got a repro with similar stack traces few times. The crash happens right before the camera renders the first frame on screen (however the camera driver seems to be initiated since the LED indicator lights up).

Here is my setup:

Activity -> Fragment -> FrameLayout -> GLSurface (OpenGL ES 2.0).

There is a high correlation between crash rate adding Wikitude GLSurface into the view by below call method:

self.addView(surface, ViewGroup.LayoutParams.MATCH_PARENT)

If I remove the last argument (ViewGroup.LayoutParams.MATCH_PARENT) the app won't be crashing on emulator nor the device. In both cases the surface will occupy the same amount of the view (will be stretched) but for some reason is crashes when it is explicitly stated that it should stretch. 

I reproed it both in Xamarin.Android and in a native Java app.

Is this a known bug?



1 Comment

Hi Luk,

please take a look at the Android ViewGroup reference. 

ViewGroup.addView as you use it has two parameters which are the child view and the index at which it should be placed.  

ViewGroup.LayoutParams.MATCH_PARENT is defined as -1 which is used as index. This should not lead to a crash since -1 is a valid index and we will investigate it. 

What i would suggest to try if you want to set the view to match the parent view is the following:


addView(surface, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));


Best Regards,


Login or Signup to post a comment