How to reproduce a bug? - android

My application sometimes crashes on some devices, with this error:
IndexOutOfBoundsException: Inconsistency detected
After some changes and spend a couple of hours, not sure if it fixed or not.
I read some of the answers and did what they say .like this post and this.
But how do I sure if the changes are working while I don't know when the exceptions occur?
How to create a situation that leads to the exception?

Related

Android - InternalSyntheticLambda onChanged$bridge crash on screen which is not related to current code

Off late I am getting these strange crashes on some of the users devices. As per the stacktrace, the code which crashed wasn't even supposed to be executed.
at <package>.ProfileFragmentKt$navigationItemSelected$drawerListenerForLogout$1$onDrawerClosed$1.onClick$lambda-1(ProfileFragmentKt.java:430)
at <package>.OveralLeaderBoard$$InternalSyntheticLambda$1$02abf2b02b6613054134ac54a51b1d4fe0a610803b5aa4ed543d8bcfe4103eb0$0.onChanged$bridge(OveralLeaderBoard.java:2)
at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133)
at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151)
at androidx.lifecycle.LiveData.setValue(LiveData.java:309)
at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:50)
OveralLeaderBoard screen has nothing to do with ProfileFragmentKt.
I have never seen this InternalSyntheticLambda, .onChanged$bridge before. You won't even find it in the class kotlin bytecode.
Can anybody tell me what this is? And how to solve it?
I had the exact same problem in the Crashlytics console of an app in production.
I managed to reproduce the crash on my phone: there were no mention of the totally unrelated fragment in my crash logs.
If fixed the crash, and there were really no reason why this unrelated fragment should be mentionned here.
So I can't explain why, but my advice would be to ignore the unrelated fragment to anyone facing this issue.

Can you catch a JNI error in a 3rd party library before a hard crash?

We are working on an Android app. We are using the Chilkat library to handle the email communication and it works well. Although, there may be a "issue" involving some JNI communication. From internet research and discussing with Chilkat, the problem may involve how EMOJI's are processed in messages.
Periodically, we get an error that hard crashes the app and it comes from the library call. It is a single line call that sometimes crashes depending on something within the message itself. Our call is...
tmpstr=email.getHtmlBody();
The hard crash error we get is:
JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal start byte 0xf0
Again, doing some internet searches on this message... this apparently is a more common issue than anyone wants but still needs to be addressed. Chilkat is working on a fix but in the meantime, we need to continue with the app.
What I am trying to figure out if there is a way that we can catch the error and prevent the app from crashing... maybe just flagging this message and continuing with the next message?
Seeing how I have never tried to catch an error from a 3rd party library, I am not sure where to go with this.
Any suggestions or examples that might help would be greatly appreciated.
Well, depending on error, you can always try to "fix" it. Working with legacy code is always hard and all you can do here are some hacks.
You can do few things here:
try to catch signals
make sure your app doesn't exit your JVM
Take a look here: http://jnicookbook.owsiak.org/recipe-No-015/ and here: http://jnicookbook.owsiak.org/recipe-No-016/
Maybe you will find some solution based on these samples.

NullPointerException in AbsSpinner.onMeasure:195, what could be the cause?

I have an Android app out there in the market. It uses Flurry, and it reports these crashes relatively often. I could never reproduce it, and since there's no stack trace, I don't even have any idea what code triggers it. Is anyone familiar with this issue?
Update: 2 years later, I'm still getting this crash pretty often.

I cant recreate java.lang.NullPointerException Android

Ive got a strange issue that has me beating my head into a brick wall. In my android app I have a method that checks the mobile state and depending on the outcome pulls an image from on line. I started to receive java.lang.NullPointerException in the developer console. It was being caused by there being no mobile state to check. Simple enough and was fixed with an if statement.
This method was in several activity's and the fix was applied to all. For some reason I am still receiving errors in the console but only for one of the activity's. The error message is the same as last time, and Ive been through the code a million times it shouldn't be doing it has the same fix as the other activity's. Also I cannot re create the error, which is making it impossible to fix. As far as I can see its not broke.
Any suggestions of what to do in this situation? Would a try and catch be appropriate?
Try cleaning (in eclipse, Project -> Clean...) your project. I find this sometimes fixes issues with the app seamingly not being updated when changes are made to the source...whether the source being a resource or source code.
Perhaps check if there are any contexts not clearly defined. Or if you simply wrote one of "(this)", try being more explicit: "(mainactivity.this)"

Strange Android Customer Error

My app had been chugging along fine on the Android market until last night when it was reported a customer found an error. The customer must have downloaded the latest version of the app because he tried to use it again with the latest version and the error came back.
I looked at the stack trace of the error and found it was caused by a NullPointerException when passing information between two activities, namely with the onActivityResult() method.
I checked the code and can't find what could have caused the error. I tried to figure out what steps the user took to get the error, but found nothing wrong, on the emulator Android 1.6 /Android 2.2 and my own phone (Android 2.2). I couldn't find any problems no matte rhow much I tried to crash the system.
Another thing that is strange is that the particular onActivityResult method is called a lot in my app. So it is odd that only one user has reported problems.
Also, it says the user's platform is "OTHER". I don't know what device that could be.
So my questions are:
1) Could this problem be an issue with the user's device and not my application?
2)What to do when you cannot find the cause of a crash?
1) Yes, they may have a custom ROM; they're known for doing things like this.
2) Unless you can reproduce it, you [probably] can't fix it.
Can you contact this customer? If not, there may be nothing you can do.

Categories

Resources