Cannot switch to Webview context on a gradle build of android

I’m automating a hybrid-app with a webview opened at start.
When compiling using eclipse, everything works fine. When I’m trying to build it with gradle, I can’t see the webview as one of the possible contexts.

Also, in the genymotion emulator, I do see the webview! But when I run it on a real device, I don’t see it.

I found this thread, but the setWebContentsDebuggingEnabled flag is already up in my app.

It all comes up to the fact that the gradle build is just not working well. Is there anything specific I need to do?

Solved.
As I suspected, our gradle was the problem.

We had a library dependency that is probably not correctly implemented.
Once we compiled our dependency into jar file and put it in our bin folder, everything worked perfectly.

Not quite sure what the problem in the dependency was, but it’s definitely not an appium issue.