I get this error

static interface method calls are not supported at language level 1.7

when having

Web3j web3j = Web3j.build(new HttpService(url));

documentation here says for Android you should use this instead of Web3j.build():

Web3jFactory.build(new HttpService());

But Web3jFactory isn't there. I have no such file for the import that should be (what I found if correct)

import org.web3j.protocol.Web3jFactory;

Here my build.gradle (reduced to relevant information)

apply plugin: 'java'

repositories {

dependencies {
    implementation 'org.web3j:core:3.3.1-android'
    implementation group: 'org.web3j', name: 'infura', version: '3.3.1'

4 Answers 4


In the latest version of the web3j-android library 'org.web3j:core:4.1.0-android', org.web3j.protocol.Web3jFactory is indeed removed. However, the documentation still says we should use it. I believe they haven't updated the documentation yet.

Instead, we should actually use the regular one:

Web3j web3j = Web3j.build(new HttpService(url));

*Note: This method is a static interface method and it's only supported in Java 8 or version 1.8

So, if your android project is still using Java 7, be sure to update your android plugin and enable Java 8 like this https://developer.android.com/studio/write/java8-support. The error will be gone and you are good to go.

Else, you could also head over to the error that says not supported, press alt+enter and select 'Set language level to 8...'

https://ethereum.stackexchange.com/a/49371/50785 is not the permanent solution I think...


If you use kotlin version you may code like this:

private var web3: Web3j? = Web3j.build(HttpService("https://ropsten.infura.io/v3/youtoken"))
    override fun onCreate(savedInstanceState: Bundle?) {

        val web3ClientVersion = web3!!.web3ClientVersion().sendAsync().get()
        val clientVersion = web3ClientVersion.getWeb3ClientVersion()
        print("Connected to Ethereum client version: $clientVersion")

I got around this problem by using this code instead which is also what Web3j.build() does if you call it

Web3j web3j = new JsonRpc2_0Web3j(httpServiceProvider.getService(url));

But meanwhile it even works with Web3jFactory for some reason!?

So if you run in this problem you can use the code above as workaround and I guess you can also leave it like that as permanent solution


This fixed it for me: https://developer.android.com/studio/write/java8-support. The layout is relatively similar to the newest versions of AndroidStudio.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.