I'm getting excessive crash reports from users on a Samsung Vibrant Galaxy S. After searching around for solutions to this issue, the only thing I came across was an open issue over at Google Code: http://code.google.com/p/android/issues/detail?id=4599
The thread suggests extending MapView and catching the exceptions. Is this the best approach, or is there something better? I'd like to completely fix this issue rather than throw a bandage on it.
Here's the Stack Trace:
java.lang.IllegalArgumentException: wrong image size: 192 192
at com.google.googlenav.map.MapTile.getImage(Unknown Source)
at com.google.googlenav.map.Map.drawTile(Unknown Source)
at com.google.googlenav.map.Map.drawMapBackground(Unknown Source)
at com.google.googlenav.map.Map.drawMap(Unknown Source)
at com.google.android.maps.MapView.drawMap(MapView.java:1048)
at com.google.android.maps.MapView.onDraw(MapView.java:486)
at android.view.View.draw(View.java:6597)
at android.view.ViewGroup.drawChild(ViewGroup.java:1533)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1260)
at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1260)
at android.view.View.draw(View.java:6600)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1533)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1260)
at android.view.View.draw(View.java:6600)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1884)
at android.view.ViewRoot.draw(ViewRoot.java:1374)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1139)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
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:862)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
at dalvik.system.NativeStart.main(Native Method)
Hopefully someone else will show up with another answer to prove me wrong, but in my personal experience with device-specific issues, catching the exceptions often seems to be the best you can do.
Edit regarding your comment below: That is a point, and I did run into some new problems with specific devices using customised WebView code when extending WebView once.
There are a ton of people on here with far more experience than me, and I hope one of them will drop in to give a more definitive answer or less hacky solution, but if necessary, you could always use android.os.Build.DEVICE, android.os.Build.MODEL and/or android.os.Build.PRODUCT to determine whether the app is running on a Samsung Vibrant Galaxy S, and (via reflection) use the custom MapView class only if it is.
May be You have done mistake here, so change the code to correct form, or enter
<uses-library android:name="com.google.android.maps" // in manifest under inside applicaiton tag
android:required="true"/>
//wrong usage of activity
public class A extends Actvitiy
{
}
//correct usage
public class A extedns MapsActivity
{
//your all program...
}
Related
It's a very strange Xiaomi device's OS exception. Even if I do have logs available from Fabric, the stack trace doesn't refer any of my code.
A crash details are below as reported in crashalytics(Fabric),
21K crashes
All crashes on Xiaomi devices
Crashes on Android OS version 6, 7 and 8
Crash Log:
# OS Version: 8.1.0
# Device: Redmi Note 5 pro
# RAM Free: 30.1%
# Disk Free: 74.2%
#0. Crashed: main
at android.widget.Editor.touchPositionIsInSelection(Editor.java:1084)
at android.widget.Editor.performLongClick(Editor.java:1205)
at android.widget.TextView.performLongClick(TextView.java:10908)
at android.view.View.performLongClick(View.java:6360)
at android.view.View$CheckForLongPress.run(View.java:24768)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:171)
at android.app.ActivityThread.main(ActivityThread.java:6606)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
--
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.widget.Editor$SelectionModifierCursorController.getMinTouchOffset()' on a null object reference
at android.widget.Editor.touchPositionIsInSelection(Editor.java:1084)
at android.widget.Editor.performLongClick(Editor.java:1205)
at android.widget.TextView.performLongClick(TextView.java:10908)
at android.view.View.performLongClick(View.java:6360)
at android.view.View$CheckForLongPress.run(View.java:24768)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:171)
at android.app.ActivityThread.main(ActivityThread.java:6606)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
#0. Crashed: main
at android.widget.Editor.touchPositionIsInSelection(Editor.java:1084)
at android.widget.Editor.performLongClick(Editor.java:1205)
at android.widget.TextView.performLongClick(TextView.java:10908)
at android.view.View.performLongClick(View.java:6360)
at android.view.View$CheckForLongPress.run(View.java:24768)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:171)
at android.app.ActivityThread.main(ActivityThread.java:6606)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
Similar Reference:
https://issuetracker.google.com/issues/37127697
java.lang.NullPointerException with Nougat
Also asked on Xiaomi official forum http://en.miui.com/forum.php?mod=viewthread&tid=4595164
Please do provide any working solution as soon as possible. As users must not be happy with these crashes.
Thanks in advance.
1) First of all, only if required, set one of these.
textView.setMovementMethod(LinkMovementMethod.getInstance());
or
setAutoLinkMask(Linkify.ALL);
or
Linkify.addLinks(textView, Linkify.PHONE_NUMBERS | Linkify.EMAIL_ADDRESSES | Linkify.MAP_ADDRESSES);
2) Secondly, set a long click listener for TextView and it must return true.
textView.setOnLongClickListener(new View.OnLongClickListener() {
#Override
public boolean onLongClick(View v) {
// do soemthing if needed
return true;
}
});
There is some internal crashing issue on Xiaomi devices. If you override setOnLongClickListener(reference) first and then follow the step one, it will use internal implementation and that will keep on crashing. So it is import to follow above steps in sequence.
I am open to other solutions, however by following this approach I don't see crash reports anymore.
Do you have a custom TextView in your app? Is it perhaps resizeable or has additional functionality?
Xiaomi's Android skin is likely interfering with that, and causing crashes. I suggest trying to long click all TextViews in your app.
It happen when user doing long click on all selected text.
Just define longClickListener:
edit_text.setOnLongClickListener {
doSomething()
true
}
and later you can remove it
edit_text.setOnLongClickListener(null)
For me this crash happened when TextView contained link and setAutoLinkMask(Linkify.ALL); was called for the view. In this case Android handles all clicks (including long clicks) by this view. On devices of other brands link was opened after long click, but on Xiaomi device crash happened. It seems, that they have a bit different logic of handling onTouchEvent inside the TextView. I've played a bit around and found, that setting android:textIsSelectable="false" for the TextView in layout file solves the problem.
I know, that it's not scalable solution, but for my case it was perfect, so I stopped investigating further. Maybe it will give a hint to someone else.
we get in the Play Store some crash reports of this kind:
java.lang.StackOverflowError
at android.graphics.Paint.getTextRunAdvances(Paint.java:1753)
at android.graphics.Paint.getTextRunAdvances(Paint.java:1726)
at android.text.TextLine.handleText(TextLine.java:758)
at android.text.TextLine.handleRun(TextLine.java:981)
at android.text.TextLine.measureRun(TextLine.java:425)
at android.text.TextLine.measure(TextLine.java:299)
at android.text.TextLine.metrics(TextLine.java:273)
.
.
.
.
at android.view.View.draw(View.java:11069)
at android.widget.FrameLayout.draw(FrameLayout.java:450)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2203)
at android.view.View.getDisplayList(View.java:10505)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:876)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:1916)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1640)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2454)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4477)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)
We had such an exception on one of our test devices and it came out, that it was because of the maximum depth of the view hierarchy.
I know that the recommendation for the max depth is <10.
However, this value is quite ambitious if you have a reasonably complex app.
We use AppCompat v21 and a ViewPager on the Main-Acitivity with Fragments.
For this reason i think we have alot of "meaningless" views, which simply encapsulates one child.
Or What is the purpose of the following layouts:
-NoSaveStateFrameLayout
-NativeActionModeAwareLayout
-FitWindowsFrameLayout
Overall, we arrive a total depth of 23 including the PhoneWindowDecorView.
Our Viewtree looks like this:
Picture from Hierarchy View
The first Views from the RootView:
Picture from Hierarchy View
Nevertheless, our app works even on very old and poor Android 2.3 devices.
Why does the problem still occur in the real world.
I'm using the ShowcaseView android library to add a welcome screen when my app is first launched.
Now, on 4.0+ (and possibly 3.0, however I haven't got a device to test it) it works perfectly, however on Gingerbread, the app crashes with the following error.
09-10 15:30:31.182 1650-1650/net.rymate.notes E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: insertShowcaseViewWithType cannot be used when the theme has no ActionBar
at com.github.espiandev.showcaseview.ShowcaseView$2.run(ShowcaseView.java:231)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Is there any way to make this work on gingerbread? I want my app to be able to work on nearly all devices, which is why I'm using a lot of support APIs.
Any help is appreciated!
The short answer is "not yet". Actually working on it as I type! Check the Github issue here for more information.
Fixed in this pull request
Feel free to fork it
You can use a custom view like this: Set Custom Font in the Action Bar,
then create new ShowcaseView like:
ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions();
co.hideOnClickOutside = true;
ShowcaseView sv = ShowcaseView.insertShowcaseView(v, this,
"TITLE", "subtitle", co);
I am getting a NullPointerException at SuggestionSpan. (Stack trace included below). As the stack trace does not include any of my code, I have absolutely no idea where to start debugging.
The error can be reproduced whenever I press space (or select a word) while using an EditText. I tried multiple keyboards including the stock Android one but the same error appears.
FATAL EXCEPTION: main
java.lang.NullPointerException
at android.text.style.SuggestionSpan.<init>(SuggestionSpan.java:128)
at android.text.style.SuggestionSpan.<init>(SuggestionSpan.java:101)
at android.widget.SpellChecker.createMisspelledSuggestionSpan(SpellChecker.java:392)
at android.widget.SpellChecker.onGetSuggestions(SpellChecker.java:300)
at android.view.textservice.SpellCheckerSession.handleOnGetSuggestionsMultiple(SpellCheckerSession.java:198)
at android.view.textservice.SpellCheckerSession.access$000(SpellCheckerSession.java:86)
at android.view.textservice.SpellCheckerSession$1.handleMessage(SpellCheckerSession.java:112)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
EDIT: I can only reproduce the error on my Nexus S with 4.0.3, but not on emulators with other OS versions. Weird.
EDIT 2: Strange thing happened! I just dragged an EditText into another activity and the same thing happens. No code is attached to it nor any XML changes made to it.
After days of investigation, it turns out that getResources().getConfiguration().locale is null. I am not sure if it is a problem specific to some versions of Android / some devices (mine is Nexus S running 4.0.3).
But I worked around this issue by checking in the constructor of the Activity (since the context given to the SuggestionSpan is my Activity) whether the locale is null, and then set it to the default one if it is.
// to prevent a weird bug where locale is null
Configuration config = getResources().getConfiguration();
if (config.locale == null)
config.locale = Locale.getDefault();
That's what I did. I am quite sure it's not the best way though. Anyone have any more ideas?
I've received a crash report with the following log content:
java.lang.NullPointerException
at android.webkit.PluginFullScreenHolder.show(PluginFullScreenHolder.java:85)
at android.webkit.WebView$PrivateHandler.handleMessage(WebView.java:8553)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4340)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
I have tried searching for PluginFullScreenHolder across the web, but line 85 appears to be a comment in the classes I've found.
I'm guessing the crash is related to a WebView - possibly because I'm trying to load null, but I'm very unsure of this, especially because I don't see a way for the URL to be null.
I believe the report comes from a Galaxy Nexus (on Android 4.0), if that makes any difference, but I'm not sure. If not, it's a Honeycomb device.
Anyone with experience in PluginFullScreenHolder?
Here's my code
web = (WebView) findViewById(R.id.webView1);
web.setBackgroundColor(android.R.color.black);
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setPluginsEnabled(true);
web.getSettings().setUserAgent(1);
web.getSettings().setSupportZoom(false);
web.loadUrl("http://www.justin.tv/widgets/live_embed_player.swf?auto_play=true&fullscreen=true&start_volume=100&hostname=www.justin.tv&channel=" + this.getIntent().getExtras().getString("channelName"));
The weird thing is that the crash report from Market doesn't mention anything about my code - nothing what so ever - you're looking at the complete log above. It's PluginFullScreenHolder.java, no doubt.
Edit 2:
Found the correct class: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/android/webkit/PluginFullScreenHolder.java#PluginFullScreenHolder.show%28%29
The line in question is:
client.onShowCustomView(mLayout, mOrientation, mCallback);
Here is the PluginFullScreenHolder.java source code for android 4.0.
At line 84, you have mWebView.getWebChromeClient() which returns null according to your exception (it is used at line 85 without null check).
A workaround is to set an empty WebChromeClient (which is called when something that might impact a browser UI happens, for instance, progress updates and JavaScript alerts are sent here) :
web.setWebChromeClient(new WebChromeClient());
But this is really strange because it should never be null.
I don't know if it can bu useful and not sure about it, but it seems like the exception is related to the superclass:
android.app.Dialog
in the method show().
You might want to take a look to the source code.
Have you tried to initialize "web"?
WebView web = new WebView(this);
web = (WebView) findViewById(R.id.webView1);
if you declared your variable like this
private WebView web;
You will get the NullpointerExeption, you must initialize the object.