`InvocationTargetException` while calling Class.forname

119 Views Asked by At

I am using the following code:

    try {
        Class.forName("android.webkit.WebView")
                .getMethod("onPause", (Class[]) null)
                .invoke(myWebView, (Object[]) null);

    } catch (Exception cnfe) {
        cnfe.getCause();
        Logger.appendErrorLog(cnfe.getMessage(), TAG);
    }

I am getting InvocationTargetException while executing the above code. What is the problem?

1

There are 1 best solutions below

0
On BEST ANSWER

Please check the dependencies you are using in pom.xml. There might be some dependencies conflicting with one another. Make sure it is not caused becaues of any dependencies.