Android Webview Chromium UnitTests fail with java.lang.NoSuchMethodError

40 views
Skip to first unread message

Yuanyuan Zhang

unread,
Jul 8, 2021, 1:08:06 PM7/8/21
to Chromium-discuss

We are currently facing this NoSuchMethod Error when we want to create the unit test with Robolectric version 4.3.1 and Mockito version 2.18.3

Exceptions:

java.lang.NoSuchMethodError: 'void com.android.webview.chromium.WebViewChromium.<init>(com.android.webview.chromium.WebViewChromiumFactoryProvider, android.webkit.WebView, android.webkit.WebView$PrivateAccess, boolean)'

Here is the code we did:

mWebView = Mockito.spy( new WebviewChromium( mockWebViewChromiumProvider, webView, webView.new PrivateAccess(), false));

We are currently facing this NoSuchMethod Error when we want to create the unit test with Robolectric version 4.3.1 and Mockito version 2.18.3

Exceptions:

java.lang.NoSuchMethodError: 'void com.android.webview.chromium.WebViewChromium.<init>(com.android.webview.chromium.WebViewChromiumFactoryProvider, android.webkit.WebView, android.webkit.WebView$PrivateAccess, boolean)'

Here is the code we did:

mWebView = Mockito.spy( new WebviewChromium( mockWebViewChromiumProvider, webView, webView.new PrivateAccess(), false));

In BUILD.gn, we have included the "//android_webview/glue:glue_java" as dependency, we can successfully compile the code but it sounds like in the runtime, it refers to the another wrong jar, does someone know how to config the build file to use the correct jar or any ideas about how to solve this error?

 
Reply all
Reply to author
Forward
0 new messages