I've an android application where I depend on few libraries internally. Now I'm trying to log the crash happening at individual component level (which means individual library level) so that it would help me in analyzing which component is causing the crash.
public class MyApplication extends Application implements Thread.UncaughtExceptionHandler {
public static final String TAG = "myapplication";
public static MyApplication applicationInstance;
public MyApplication() {
Thread.setDefaultUncaughtExceptionHandler(this);
}
@Override
public Context getApplicationContext() {
return super.getApplicationContext();
}
public static MyApplication getInstance() {
return applicationInstance;
}
@Override
public void onTerminate() {
super.onTerminate();
}
@Override
public void onLowMemory() {
super.onLowMemory();
}
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
}
@Override
public void uncaughtException(Thread t, Throwable e) {
Log.i(TAG, "Inside uncaught exception..." + Thread.currentThread().getId());
//getPackageName() here returns the name of the application instead of the dependent library's one.
}
}
Is there any way available to get the package name of the library added in their android manifest?