8

When I try to run my application on Huawei P9 I’m getting the error

Attempt to invoke virtual method 'int com.huawei.lcagent.client.LogCollectManager.getUserType()' on a null object reference

Is there any way to debug this because application works on other Android 6 phones (Samsung, HTC...).

APP: https://play.google.com/store/apps/details?id=com.morescreens.mkt

LOG:

07-04 10:42:56.045: W/System.err(955): java.lang.NullPointerException: Attempt to invoke virtual method 'int com.huawei.lcagent.client.LogCollectManager.getUserType()' on a null object reference 07-04 10:42:56.046: W/System.err(955): at com.android.server.util.ReportTools.getUserType(ReportTools.java:86) 07-04 10:42:56.046: W/System.err(955): at com.android.server.util.ReportTools.isBetaUser(ReportTools.java:73) 07-04 10:42:56.046: W/System.err(955): at com.android.server.util.ReportTools.report(ReportTools.java:58) 07-04 10:42:56.046: W/System.err(955): at com.android.server.util.HwUserBehaviourRecord.appExitRecordInnerImpl(HwUserBehaviourRecord.java:125) 07-04 10:42:56.046: W/System.err(955): at com.android.server.util.HwUserBehaviourRecord.access$200(HwUserBehaviourRecord.java:32) 07-04 10:42:56.046: W/System.err(955): at com.android.server.util.HwUserBehaviourRecord$AsyUploadLooperThread$1.handleMessage(HwUserBehaviourRecord.java:255) 07-04 10:42:56.046: W/System.err(955): at android.os.Handler.dispatchMessage(Handler.java:102) 07-04 10:42:56.046: W/System.err(955): at android.os.Looper.loop(Looper.java:150) 07-04 10:42:56.046: W/System.err(955): at com.android.server.util.HwUserBehaviourRecord$AsyUploadLooperThread.run(HwUserBehaviourRecord.java:267)

Does anyone experianced such issue? What is the best way to contact Huawei support for this error? I send them e-mail on consumer support site. Is there any developer support site or e-mail? Please provide links. Thanks in advance!

EDIT: I have figured out that this exception wasn't invoked by my app. However, my app was exiting nearly this exception which led me to think that app is crashing but in fact something was killing my app. It was my code in Application.onTrimMemory method which was "Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process". I still don't know why this method was called only on Huawei P8, P9 devices, never get any response from Huawei support.

harazination
  • 91
  • 1
  • 6
  • Exactly same stack trace "bla bla calling getUserType()..." and app kill with a P9 Lite phone, in my case it happens after posting a runnable to the main looper. It looks like an internal bug in the Huawei implementation, I had to workaround this by accessing the main thread from another random place in my application workflow. – carrizo Nov 24 '16 at 04:12
  • Same happened with me. My application started in my Oneplus 2 but wouldn't start on Honor 6. I was checking for permissions at startup and i guess somewhere just after the permission has been taken, it would crash. Try and identify your code that is crashing it and for the time being surround it by try catch to make it work. – Udit Shah Dec 22 '16 at 05:03

5 Answers5

4

The exception is generic, could have many causes and I found that the best way to go deeper and have a detailed view of it, it's enable more detailed log in Project Menu of the phone.

On P9 can be done writing the code: * # * # 2846579 # * # *
in phone number composition, it open Project Menu such as in picture: Project Menu

then choose Background settings -> Log settings and check all the items; your logcat will be more detailed and easier to find the original error that give that exception. After using, uncheck in Log settings to avoid degrading your phone system performance.

In my case, it was a iap plugin inserted in unity project in my app, too old, never used but initialized: this crash my app and give the error; deleting it and all it's ok.

android_dev71
  • 517
  • 5
  • 7
2

I know this is old but my problem showed when i added service with non-existing class in manifest.

0

I get the same Error.
Just in case you don't get an answer here, be sure to check my question .

PS: would have written this as a comment, but unfortunately i haven't earned enough reputation yet

Community
  • 1
  • 1
David
  • 101
  • 1
  • 1
  • 8
0

I was getting this error because I was passing an int to a TextViews setText method.

Fix that worked..

textView.setText(intValue + "");
Reaver
  • 101
  • 3
-1

you just need to goto settings of your device and then goto "Apps" and Select you app after that and Give permission All permissions...it would be working after that