I'm trying to initialize web3j with following code:

Web3j web3 = Web3j.build(new HttpService());  // defaults to http://localhost:8545/
Web3ClientVersion web3ClientVersion = null;
try {
    web3ClientVersion = web3.web3ClientVersion().sendAsync().get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
String clientVersion = web3ClientVersion.getWeb3ClientVersion();

Also I've added as per manual dependency

compile ('org.web3j:core-android:2.2.1')

But android studio refuses to compile that.It says cannot resolve method

enter image description here

1 Answer 1


Just noticed at the bottom of the manual following text:

Note: for Android use:

Web3j web3 = Web3jFactory.build(new HttpService()); // defaults to http://localhost:8545/

However I'm still unable to compile it due to this exception:

Java7Support: Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added

  • fixed by changing java_home path in system variables
    – undefined
    Jan 28, 2018 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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