Activity Closed Throwing DeadObjectException with un-notified error code part
The process is being dead, because of the ambiguous context used in the both onClickListener to start activity, while passing the context to the list adapter, in have used getApplicationContext() to pass context to the adapter.
This the problem it could not host the process and killing the activity resulting in crash or DeadObjectException.
Problem in lines:
context.startActivity(intent);
context.startActivity(i);
and context given as getApplicationContext()
Solution:
Change getApplicationContext() to SomeActivity.this
And might be API28 has got its own new rules so, that's why it caused problem in devices with API28 or above.
Hope this helps others.
GetPackageInfo results in DeadObjectException
A better way to fetch your own versionName (which I assume you are trying to do, judging your code) is to call BuildConfig.VERSION_NAME
. This requires that the App is built with gradle and the version is defined in your app.gradle file.
For the PackageManager Problem itself I have a theory, though only anecdotal (copying from my comment on the question):
I ran into the same problem a while back. It seems when the IPC Communication from the PackageManager tries to send too much data it somehow dies. It will stay dead until your app restarts. The only "solution" I found is to limit the data provided from getPackageInfo with it's flags.
DeadObjectException when pressure test
Through the analysis of the memory, it was found that the Handler object was repeatedly created when the AIDL command was initiated, and the Handler object was not cleaned up in time, resulting in a memory leak.
Related Topics
Tcp\Ip Client - Ehostunreach (No Route to Host)
Method Called After Release() Exception Unable to Resume with Android Camera
How to Close Another App in Android
How to Implement the Android Actionbar Back Button
Android: Why Setvisibility(View.Gone); or Setvisibility(View.Invisible); Do Not Work
Android Getintent().Getextras() Returns Null
Android Studio Mailto Intent Doesn't Show Subject and Mail Body
How to Script the Java Debugger Command-Line Tool (Jdb)
Alternative to Jzebra/Qz Java Raw Print Plugin After Npapi Being Dropped on Chrome Browser
Wrong Version of Keystore on Android Call
Urlconnection Getcontentlength() Is Returning a Negative Value
Automatically Log Android Lifecycle Events Using Activitylifecyclecallbacks
Why Menuitemcompat.Getactionprovider Returns Null
Should I Strictly Avoid Using Enums on Android
Onrequestpermissionsresult Not Being Called in Dialog Fragment
Android - Imageloader Must Be Init with Configuration Before Using in Uil