java-binance-api icon indicating copy to clipboard operation
java-binance-api copied to clipboard

Android support?

Open ralphilius opened this issue 7 years ago • 3 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

ralphilius avatar Jan 29 '18 16:01 ralphilius

may be official library will work for your purposes?

wcrbrm avatar Jan 29 '18 16:01 wcrbrm

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

ralphilius avatar Jan 29 '18 17:01 ralphilius

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.

wcrbrm avatar Jan 29 '18 20:01 wcrbrm