0

I'm have deployed contracts on ethereum blockchain. I have ganache running on server

I'm tring to connect to it from android with this code:

private BlockChainService() {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl("http://127.0.0.1:8545/")
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .build();
        blockChainApi = retrofit.create(BlockChainApi.class);
    }

But it's raising exception with the message - "failed to connect to /127.0.0.1:8545". I've tried opening the app from genymotion emulator and from the actual device also but the problem is still the same.

I also have spring boot application which is successfully connecting with ganache using exactly the same code. So my guess is that it's related to network.

So my question is how can I connect from android app to ganache? Is it a problem with the network?

1

Everyone having the same problem. The solution was to just change ganache server setting to wifi(of course mobile device and laptop have to be on the same wifi to work) enter image description here

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.