webcerebrium / java-binance-api

Java Binance API Client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android support?

ralphilius opened this issue · comments

I'm trying to run this on Android, but can't seem to get this compile.

try {
    BinanceSymbol symbol = new BinanceSymbol("ETHXLM");
    new BinanceApi().websocketTrades(symbol, new BinanceWebSocketAdapterAggTrades() {
        @Override
        public void onMessage(BinanceEventAggTrade event) throws BinanceApiException {
            Log.i(TAG, "onMessage: "+event.getPrice()+"/"+event.getQuantity());
        }
    });
} catch (BinanceApiException e) {
    e.printStackTrace();
}

Error message:

Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing org/eclipse/jetty/util/statistic/SampleStatistic.class
Error:com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
...and more

It seems that this will only work on Android 8.0 since the jetty library is not support for earlier versions

may be official library will work for your purposes?

I've tried with that earlier but no luck. That's why I seek for this library in hope that it could work :)

Well you can fork this library and remove 4 websocket classes to replace jetty's dependency with other websocket client that works. I would also love to know what is working on the old Android.