Android NullPointerException in Instrumentation.execStartActivity - android

I keep getting the bellow exception from some users:
java.lang.NullPointerException
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1414)
at android.app.Activity.startActivityForResult(Activity.java:2880)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
at android.app.Activity.startActivity(Activity.java:2986)
at com.google.android.gms.internal.bb$5.onClick(Unknown Source)
at android.view.View.performClick(View.java:2535)
at android.view.View$PerformClick.run(View.java:9130)
at android.os.Handler.handleCallback(Handler.java:618)
at android.os.Handler.dispatchMessage(Handler.java:123)
at android.os.Looper.loop(SourceFile:351)
at android.app.ActivityThread.main(ActivityThread.java:3826)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:538)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:969)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:727)
at dalvik.system.NativeStart.main(Native Method)
I've found a similar problem here but it's not taken care of since April. All I know is that it was reproduced on a Samsung Galaxy Y (GT-S5360) and I'm using Google Maps Android API v2.
Do you have any idea how can I make a workaround for this?

I have the same error, I also use Google Maps API. It seems to happen on all Android versions and phones. Just to mention few:
AN10DG3, GT-I8190, F815, GT-I9300, GOOPHONE, HTC One, KFTT, MID8127, KFAPWI, AN10DG3
java.lang.NullPointerException
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1409)
at android.app.Activity.startActivityForResult(Activity.java:3351)
at android.app.Activity.startActivityForResult(Activity.java:3312)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:839)
at android.app.Activity.startActivity(Activity.java:3522)
at android.app.Activity.startActivity(Activity.java:3490)
at com.google.android.gms.dynamic.a$5.onClick(Unknown Source)
at android.view.View.performClick(View.java:4084)
at android.view.View$PerformClick.run(View.java:16966)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
as I read somewhere, solution is:
Above mentioned problem can occur if you have emulator or device in which google play services are not installed. I don't have perfect solution but I figured out some work around to save your app from crashing. In this case you have to follow simple steps
Override startActivityForResult(intent, requestcode)
In startActivityForResult add super call super.startActivityForResult in try catch and catch the NullPointerException
Easy its done Now you can trap the nullpointerexception here and add your error handling in catch
#Override
public void startActivityForResult(Intent intent, int requestCode) {
try {
super.startActivityForResult(intent, requestCode);
} catch (Exception e) {
// fixes Google Maps bug: http://stackoverflow.com/a/20905954/2075875
}
}

in my case crash in Instrumentation.java
line 1581,
android.util.SeempLog.record_str(377, intent.toString());
intent is null then NPE
not sure how to fix this

Related

Firebase Authentication causing Android fatal exception

I just finished integrating Firebase real time data base and Authentication into my Android Studio application. It ran successfully two or three times on my Google Nexus 7 genymotion emulator that has google play services on it. Then I tried launching it again and I started getting the below error:
06-25 16:50:46.994 7699-7699/
com.careersvirtualsolutions.uprate E/AndroidRuntime:
FATAL EXCEPTION: main
java.lang.NullPointerException
at com.google.firebase.auth.FirebaseAuth$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
I think this has something to do with the Firebase Authentication SDK but I am not sure.
Do you know what this is caused by? How can I solve it?
I actually figured it out, the problem was with the AuthStateListener.
So if you're having a similar issue, try testing your project with the AuthStateListener commented out and see if it launches without crashing. If it does you can then figure out how to replace the existing listener.
Hope this helps in some way!

First time Google Map API

I am a first time Android Studio user, trying to get the Google Map app to run from the samples provided. Android-Studio is running on a Gentoo Linux platform, using Java 8. I have followed the directions on how to add Google Play services, added the definition to Gradle, far as I can tell it is the virtual device that does not have Google play service support. I have also added pro-guard rules, error is always the same. The build rules and dependencies have the entries from the documentation. It looks like it should work.
It is obvious that I am missing something basic. The basic HelloWorld works fine, I am stumbling on Google's security and the mechanism by which they are invoked. Reviewing the documentation, I see references to GoogleAPIClient -- Do I have to setup the client connection before trying to connect? Is there, perhaps sample code where this process is defined correctly, with all its pieces?
The studio itself is at current revision levels. From the error, is it possible I have missed something else, the ActivityNotFound exception?
The LogCat message stream
09-10 10:07:16.449 1006-1006/cx.ath.klatt.test1 E/AndroidRuntime﹕ FATAL EXCEPTION: main
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms flg=0x80000 pkg=com.android.vending }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
at android.app.Activity.startActivityForResult(Activity.java:3370)
at android.app.Activity.startActivityForResult(Activity.java:3331)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:840)
at android.app.Activity.startActivity(Activity.java:3566)
at android.app.Activity.startActivity(Activity.java:3534)
at com.google.android.gms.dynamic.a$5.onClick(Unknown Source)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17355)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
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:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
09-10 10:07:18.929 1006-1006/cx.ath.klatt.test1 I/Process﹕ Sending signal. PID: 1006 SIG: 9
09-10 10:07:47.989 1035-1035/cx.ath.klatt.test1 W/GooglePlayServicesUtil﹕ Google Play services is missing.
The device in which you are installing, the google play services need to be installed and need to be up to date also.

My app keeps getting crash reports in google play, but I cannot reproduced the crash

I'm getting daily crash reports from Google Play. I'm running out of ideas and wondering if there is any tutorials or something on how to find and fix bugs from google plays stack report.
I have done the following
Bought one of the devices it is crashing on, Galaxy tab. Tried to crash it, could not get it to crash. Tied to have a lot of apps running in background still did not crash.
put try catch around all my code where the catch would bring up a generic memory low warning message (ie this really slowed down the app).
Checked all my return values.
From the stack report, I'm assuming it is crashing somewhere in onTouchEvent methed in my cPuzzleView class.
Any help would be GREAT
stack
java.lang.NullPointerException
at com.fairhvaenapps.toddpuzzlefree.cPuzzleView.onTouchEvent(cPuzzleView.java:653)
at android.view.View.dispatchTouchEvent(View.java:7380)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2210)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1953)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2210)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1953)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2210)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1953)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2111)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1559)
at android.app.Activity.dispatchTouchEvent(Activity.java:2478)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2059)
at android.view.View.dispatchPointerEvent(View.java:7560)
at android.view.ViewRootImpl$1.doDispatch(ViewRootImpl.java:338)
at com.lge.view.TouchEventFilter.dispatchFilteredTouchEvent(TouchEventFilter.java:131)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3333)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3255)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4418)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4397)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4506)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:171)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4468)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4525)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:530)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5223)
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:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:564)
at dalvik.system.NativeStart.main(Native Method)

How to understand such stack trace from Google Play app?

On Google Play developer console I sometimes get crash reports that I don't understand at all. There is noting from my app code in the stack trace reported. Could anyone shed some light e.g. on this one?
java.lang.NullPointerException
at android.os.Parcel.readException(Parcel.java:1338)
at android.os.Parcel.readException(Parcel.java:1286)
at android.speech.tts.ITextToSpeechService$Stub$Proxy.setCallback(ITextToSpeechService.java:573)
at android.speech.tts.TextToSpeech$Connection.onServiceConnected(TextToSpeech.java:1278)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1125)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1142)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4945)
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)
It's clearly in some Text to Speech package, but how am I, the app author, resposible for this one? I do initialize TTS and my app is reading text aloud, but how can I fix such error?
Greg
here is your errors
ITextToSpeechService$Stub$Proxy.setCallback(ITextToSpeechService.java:573)
it's clearly !

Android, howto catch a mystic system exception

There is an exceptions, which I got in Android on drag.
Google doesnt know about this exception.
Question:
Any Idea, what to override to catch this exception? Something seems to hppen inside of the system, because all the listed classes are frameworks native classes.
Window Session Crash
java.lang.IllegalStateException: reportDropResult() by non-recipient
at com.android.server.wm.Session.reportDropResult(Session.java:307)
at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:369)
at com.android.server.wm.Session.onTransact(Session.java:111)
at android.os.Binder.execTransact(Binder.java:320)
at dalvik.system.NativeStart.run(Native Method)
FATAL EXCEPTION: main
java.lang.IllegalStateException: reportDropResult() by non-recipient
at android.os.Parcel.readException(Parcel.java:1329)
at android.os.Parcel.readException(Parcel.java:1275)
at android.view.IWindowSession$Stub$Proxy.reportDropResult(IWindowSession.java:900)
at android.view.ViewRoot.handleDragEvent(ViewRoot.java:3015)
at android.view.ViewRoot.handleMessage(ViewRoot.java:2164)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4025)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
at dalvik.system.NativeStart.main(Native Method)
There is an exceptions, which I got in Android on drag. Google doesnt know about this exception.
Since I can't find a reportDropResult() in the Android 2.3 source, I am guessing that this is from the new drag-and-drop framework introduced with Honeycomb.
Any Idea, what to override to catch this exception?
You can't override anything to catch that exception. To catch unhandled exceptions, use Thread and setDefaultUncaughtExceptionHandler().

Categories

Resources