DeadObjectException thrown by queryIntentActivities - android

I'm getting the DeadObjectException from queryIntentActivities rarely.
This is all I found for this issue: http://comments.gmane.org/gmane.comp.handhelds.android.acra/184 So I tried to adjust my code like following (comment in this code is derived from the post mentioned above).
I'm trying following:
Old code
List<ResolveInfo> ril = pm.queryIntentActivities(mainIntent, 0);
New code
List<ResolveInfo> ril = null;
try
{
ril = pm.queryIntentActivities(mainIntent, 0);
// process data...
}
catch (DeadObjectException e)
{
// possibly happens because this process is still running but app is currently being updated by the android system
// if this is really true, we can ignore the exception as the complete progress will be stopped anyways...
L.e(e);
}
Problem
I can't catch the exception, because by definition it is never thrown by queryIntentActivities. What can I do instead now to avoid this crash? I don't want to catch all exceptions here.
Additionally I'm not sure if this exception really only happens, I've my app is updated while trying to call queryIntentActivities, it's just an assumption based on the post above. Can anyone confirm this?
Stacktrace
java.lang.RuntimeException: Unable to start receiver com.my.app.receivers.PackageReceiver: java.lang.RuntimeException: Package manager has died
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3641)
at android.app.ActivityThread.access$2000(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1876)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.RuntimeException: Package manager has died
at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:765)
at android.app.ApplicationPackageManager.queryIntentActivities(ApplicationPackageManager.java:747)
at com.my.app.utils.AppUtil.a(AppUtil.java:230)
at com.my.app.receivers.PackageReceiver.onReceive(PackageReceiver.java:42)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3634)
... 8 more
Caused by: android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:503)
at android.content.pm.IPackageManager$Stub$Proxy.queryIntentActivities(IPackageManager.java:3940)
at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:755)
... 12 more
java.lang.RuntimeException: Package manager has died
at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:765)
at android.app.ApplicationPackageManager.queryIntentActivities(ApplicationPackageManager.java:747)
at com.my.app.utils.AppUtil.a(AppUtil.java:230)
at com.my.app.receivers.PackageReceiver.onReceive(PackageReceiver.java:42)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3634)
at android.app.ActivityThread.access$2000(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1876)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:503)
at android.content.pm.IPackageManager$Stub$Proxy.queryIntentActivities(IPackageManager.java:3940)
at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:755)
... 12 more
android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:503)
at android.content.pm.IPackageManager$Stub$Proxy.queryIntentActivities(IPackageManager.java:3940)
at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:755)
at android.app.ApplicationPackageManager.queryIntentActivities(ApplicationPackageManager.java:747)
at com.my.app.utils.AppUtil.a(AppUtil.java:230)
at com.my.app.receivers.PackageReceiver.onReceive(PackageReceiver.java:42)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3634)
at android.app.ActivityThread.access$2000(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1876)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Related

How can I get address information using latitude and longitude?

I made this tutorial for get user's address and location but I got error when I changed AVD's location. When I didn't call getCityName function at getLastLocation function, I can get user's location but when I call it, it gave that error. How can I solve it?
it was give an error which was :
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.slidework3, PID: 15792
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
Caused by: java.io.IOException: grpc failed
at android.location.Geocoder.getFromLocation(Geocoder.java:136)
at com.example.slidework3.AdresPage.getCityName(AdresPage.kt:152)
at com.example.slidework3.AdresPage.access$getCityName(AdresPage.kt:20)
at com.example.slidework3.AdresPage$getLastLocation$1.onComplete(AdresPage.kt:66)
at com.google.android.gms.tasks.zzj.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
Edit:
I tried real device, location services working well I can get city name, street name etc. But in simulator it was give error again. I tried to change AVD's location after that it was going to crash. I believe solution is simple but I don't know how can I search this situation.
Try run the operation in a new Thread, and then if I need to update some UI view I'll do it on runOnUiThread.
https://developer.android.com/training/location/display-address#java

java.lang.IllegalArgumentException: Invalid speaker model provided

I'm developing app in android and for some reason I'm receiving this error.
I did not change any code line and suddenly I'm getting this error.
I have no idea what should i do, its not even pointing where the problem is.
LOG
02-22 20:22:42.884 4637-4637/? E/HotwordDetector: Invalid or incompatible speaker models. Silent enrollment required.
java.lang.IllegalArgumentException: Invalid speaker model provided
at com.google.speech.micro.GoogleHotwordRecognizer.nativeNew(Native Method)
at com.google.speech.micro.GoogleHotwordRecognizer.<init>(SourceFile:6)
at com.google.android.libraries.assistant.hotword.k.a(SourceFile:65)
at com.google.android.libraries.assistant.hotword.k.as(SourceFile:35)
at com.google.android.apps.gsa.voiceinteraction.hotword.a.esf(SourceFile:48)
at com.google.android.apps.gsa.voiceinteraction.hotword.b.handleMessage(SourceFile:4)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
02-22 20:22:42.907 4637-4637/? E/HotwordDetector: Invalid or incompatible speaker models. Silent enrollment required.
java.lang.IllegalArgumentException: Invalid speaker model provided
at com.google.speech.micro.GoogleHotwordRecognizer.nativeNew(Native Method)
at com.google.speech.micro.GoogleHotwordRecognizer.<init>(SourceFile:6)
at com.google.android.libraries.assistant.hotword.k.a(SourceFile:65)
at com.google.android.libraries.assistant.hotword.k.as(SourceFile:35)
at com.google.android.apps.gsa.voiceinteraction.hotword.a.esf(SourceFile:48)
at com.google.android.apps.gsa.voiceinteraction.hotword.b.handleMessage(SourceFile:4)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
02-22 20:22:42.929 4637-4637/? E/HotwordDetector: Invalid or incompatible speaker models. Silent enrollment required.
java.lang.IllegalArgumentException: Invalid speaker model provided
at com.google.speech.micro.GoogleHotwordRecognizer.nativeNew(Native Method)
at com.google.speech.micro.GoogleHotwordRecognizer.<init>(SourceFile:6)
at com.google.android.libraries.assistant.hotword.k.a(SourceFile:65)
at com.google.android.libraries.assistant.hotword.k.as(SourceFile:35)
at com.google.android.apps.gsa.voiceinteraction.hotword.a.esf(SourceFile:48)
at com.google.android.apps.gsa.voiceinteraction.hotword.b.handleMessage(SourceFile:4)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Any idea why is it crashing?
AudioRecord is not initialized, its null, you can see e in the first line
02-22 20:22:42.863 4637-5379/? E/AudioProvider: AudioRecord is null, can't start recording
Their is some mistake in layout/.xml file i.e designing part, check that properly.
In my case i got it because i was VerticalViewPager in main activity but in xml i passed it as viewpager.

Android - Could not read input channel file descriptors from parcel

java.lang.RuntimeException: Could not read input channel file descriptors from parcel.
at android.view.InputChannel.nativeReadFromParcel(Native Method)
at android.view.InputChannel.readFromParcel(InputChannel.java:148)
at android.view.InputChannel$1.createFromParcel(InputChannel.java:39)
at android.view.InputChannel$1.createFromParcel(InputChannel.java:37)
at com.android.internal.view.InputBindResult.<init>(InputBindResult.java:68)
at com.android.internal.view.InputBindResult$1.createFromParcel(InputBindResult.java:112)
at com.android.internal.view.InputBindResult$1.createFromParcel(InputBindResult.java:110)
at com.android.internal.view.IInputMethodManager$Stub$Proxy.startInputOrWindowGainedFocus(IInputMethodManager.java:723)
at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:1338)
at android.view.inputmethod.InputMethodManager.checkFocus(InputMethodManager.java:1519)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4187)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7390)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:926)
I've been constantly receiving this crash report on my app. What can be cause this?

Package Manager has died, DeadObjectException

We use our app on only one device type and we get this error pretty often on it.
The only instance for PackageManager is a BootupReceiver:
public class RestartHelper extends BroadcastReceiver
{
#Override
public void onReceive(Context context, Intent intent) {
Logger.getInstance().Log("Restart received");
Intent i = context.getPackageManager().getLaunchIntentForPackage( context.getPackageName() );
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(i);
}
}
Exception:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test/com.test.MainActivity}: java.lang.RuntimeException: Package manager has died
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Package manager has died
at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:239)
at android.support.v4.app.NavUtils.getParentActivityName(NavUtils.java:301)
at android.support.v4.app.NavUtils.getParentActivityName(NavUtils.java:281)
at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:152)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:60)
at com.cotris.roosapp.StandardActivity.onCreate(StandardActivity.java:49)
at com.cotris.roosapp.MainActivity.onCreate(MainActivity.java:64)
at android.app.Activity.performCreate(Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
... 11 more
Caused by: android.os.DeadObjectException
at android.os.BinderProxy.transact(Native Method)
at android.content.pm.IPackageManager$Stub$Proxy.getActivityInfo(IPackageManager.java:1791)
at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:234)
... 20 more
Is this error hardware/system related?
Obviously there has another PackageManger call but not only in RestartHelper.java:
at com.cotris.roosapp.StandardActivity.onCreate(StandardActivity.java:49)
You man need to check the code detail in that.
The android.os.DeadObjectException means that you link to something, that does not exist any more.
the solution for my case was a hardware related problem, which created all kind of crashes of system processes in the background on the device.

Realm Wrong transactional state (no active transaction, wrong type of transaction, or transaction already in progress)

I am using Realm for android and the error log does not show any error trace inside my project.
My logcat output looks like this:
Process: com.toyanathpatro.gurkha, PID: 7600
io.realm.exceptions.RealmError: Unrecoverable error. Wrong transactional state (no active transaction, wrong type of transaction, or transaction already in progress) in io_realm_internal_SharedGroup.cpp line 157
at io.realm.internal.SharedGroup.nativeAdvanceRead(Native Method)
at io.realm.internal.SharedGroup.advanceRead(SharedGroup.java:83)
at io.realm.internal.ImplicitTransaction.advanceRead(ImplicitTransaction.java:35)
at io.realm.internal.SharedGroupManager.advanceRead(SharedGroupManager.java:76)
at io.realm.HandlerController.realmChanged(HandlerController.java:384)
at io.realm.HandlerController.handleMessage(HandlerController.java:116)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Categories

Resources