Making sure library project doesn't crash app

59 Views Asked by At

I am making an library project in android. How do I make sure that integration of the library project doesn't crash the app because of any exceptions in the library project. How do I wrap the entire library to handle exception at runtime and log it and doesn't force close the application

2

There are 2 best solutions below

0
Rahul R On
try{
// codes 
} 
catch (Exception E )
{

}

How to handle try catch exception android

0
Chaitanya Atkuri On

There is no such exception handling for the entire project.

For developing a better library/ app try running on few devices with different OS version making sure you cover all the possible usecases.

If the above procedure seems to be a bit time consuming. Try writing test cases and execute them on various devices.

For reference :

https://developer.android.com/training/testing/start/index.html