2

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) {
    e.printStackTrace();
} catch (ExecutionException e) {
    e.printStackTrace();
}
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

undefined
  • 151
  • 6

1 Answers1

2

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

undefined
  • 151
  • 6