26

In the developer console on the Android market we are getting a lot of stack traces like this (sent in by users when our app crashes):

java.lang.NullPointerException at
android.view.ViewRoot.updateBidiOptions(ViewRoot.java:290) at
android.view.ViewRoot.performTraversals(ViewRoot.java:737) at
android.view.ViewRoot.handleMessage(ViewRoot.java:1792) at
android.os.Handler.dispatchMessage(Handler.java:99) at
android.os.Looper.loop(Looper.java:143) at
android.app.ActivityThread.main(ActivityThread.java:5068) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:521) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) at
dalvik.system.NativeStart.main(Native Method)

We have not been able to reproduce the crash and also when we check the Android source code, there is no method called updateBidiOptions. The user comments seems to suggest that the crash happens when they focus on an EditText. Many of the users also mention that this happens on HTC Desire HD but it is not crashing on the Desires we have here.

How can we fix this problem?

11
  • Is that all you get? You won't find updateBidiOptions in your code base as it is an Android internal method. Commented Apr 4, 2011 at 9:43
  • Yes, that is all I get (410 reports so far).
    – perja
    Commented Apr 4, 2011 at 10:31
  • 1
    My guess is that the method ViewRoot#updateBidiOptions is something added by HTC in order to support BiDi in Android.
    – perja
    Commented Apr 4, 2011 at 10:35
  • 1
    That might be possible as I can't find that method in the official source code. Commented Apr 4, 2011 at 12:11
  • I have HTC Desire HD. What is the name of your app? I want to test it Commented Apr 15, 2011 at 12:56

4 Answers 4

2

Usually when you see a NPE in a stacktrace that does not involve any of your own code, at some point you have passed null as a parameter to the Android framework where you are not supposed to.

So if you have any place in the code where you might be in doubt if you are passing null as an option, double check that you are allowed to do that.

Otherwise, what Android version is this crash happening on?

If we have the correct source for android.view.ViewRoot.updateBidiOptions(ViewRoot.java:290) we should be able to see what reference is being referred and is a null reference. And step back from there until we see a reference provided from your source (that is probably also null).

However, when I look at the source for ViewRoot.java in my gingerbread clone, I don't even see the method updateBidiOptions(). Thus I need to know the approximate Android version being used, to give an educated guess on which reference it might be.

1

Just to finish up this one: the problem was with a custom ROM (B0.8). The problem resolved itself when that ROM was updated to B0.8.4 which no longer calls updateBidiOptions.

0

ok the easy solution will be this : locate the line that actaully brings this up in your code if you say that this is the edittext, so wrap anything that belongs to it, in try and catch, then in the catch try do what it was supposed to do in the first time, if it's to give the edittext focus, request the focuse for it.

Hope this helps, Best regards.

1
  • From the stacktrace, there's nothing in the stack that triggers the updateBidiOptions() call, which means a try/catch will never be able to catch this exception, since it's happening entirely from system/platform code.
    – Joe
    Commented Jun 15, 2011 at 21:00
0

It seems as if 1 out of 2 possible things are happening here.

It is possible that researchers at MIT have chosen to use your application to test on an experimental bit of technology dubbed the BiDi Screen. They quite probably modified some of the Android OS and recompiled it to interface their experimental tech possibly running on some experimental mobile device. You may have unearthed one of Google's "black projects".

Another idea is that you are looking at a "String localization" error from another country. See Class Bidi.

A Bidi object provides information on the bidirectional reordering of the text used to create it. This is required, for example, to properly display Arabic or Hebrew text. These languages are inherently mixed directional, as they order numbers from left-to-right while ordering most other text from right-to-left.

Since you work for a larger company, ask your higher-up to send you on an information gathering trip to one of the Arab Spring countries to gather 'in field data' on why your application is crashing so frequently.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.