After setting testInstrumentationRunner "com.example.theapp.utils.CustomAndroidJUnitRunner"
in Gradle and in Run/Debug Configurations -> Android Tests -> MyInstrumentedTest -> General -> Specific instrumentation runner (optional)
and extending AndroidJUnitRunner
:
import android.app.Application;
import android.content.Context;
import android.support.test.runner.AndroidJUnitRunner;
public class CustomAndroidJUnitRunner extends AndroidJUnitRunner {
@Override
public Application newApplication(ClassLoader cl, String className, Context context) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return super.newApplication(cl, className, context);
}
@Override
public void callApplicationOnCreate(Application app) {
super.callApplicationOnCreate(app);
}
}
I set BP in newApplication
and in callApplicationOnCreate
and see that callApplicationOnCreate
is called, but not newApplication
. What could be the problem?