Menu Home

web3j Android port now available for Ethereum

After announcing the 1.0 milestone of web3j, it was clear that there was demand for an Android port of web3j.

As of the latest release - 1.0.5 of web3j, I am publishing Java 1.6 (i.e. Android) compatible releases. The first Android release is available here, and the artefacts are available on JFrog's Bintray and Maven's Nexus repositories:

<dependency>
  <groupId>org.web3j</groupId>
  <artifactId>core-android</artifactId>
  <version>1.0.5</version>
</dependency>
compile ('org.web3j:core-android:1.0.5')

The API is nearly identical to the existing API, with one small difference - you need to use a Web3jFactory to create your client instance:

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

You can use the web3j command line tools for generating your smart contract wrappers (the generated code is also Android compatible).

For further release notes, please head to the 1.0.5-android release page.

Categories: Blockchain Development Ethereum Java web3j

Tagged as:

conor

2 replies

  1. Was trying web3j api of core-1.0.7 jar in java to access ethereum node using below snippet of code but HttpService is not getting imported though class available in jar

    Web3j web3 = Web3j.build((Web3jService) new HttpService()}; // defaults to ..

    what is the reason for it

  2. The imports you require are:

    import org.web3j.protocol.http.HttpService;
    import org.web3j.protocol.Web3j;

    Then you should be good to go.

Leave a Reply

Your email address will not be published. Required fields are marked *