webcerebrium / java-binance-api

Java Binance API Client
MIT License
75 stars 37 forks source link

Android support? #19

Open ralphilius opened 6 years ago

ralphilius commented 6 years ago

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

wcrbrm commented 6 years ago

may be official library will work for your purposes?

ralphilius commented 6 years ago

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

wcrbrm commented 6 years ago

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.