2

I'm not able to obtain the client. I'm starting on Android development, so maybe it's a config/newbie mistake, but nothing I've tried/searched works. Each time I call "RxBleClient.create(context);", I get the following error:

FATAL EXCEPTION: Thread-34217
Process: es.ralcaidev.arduinobt, PID: 15488
java.lang.IncompatibleClassChangeError: The method 
'void com.polidea.rxandroidble.internal.radio.RxBleRadioImpl.com_polidea_rxandroidble_internal_radio_RxBleRadioImpl_lambda$new$0()' 
was expected to be of type direct but instead was found to be of type virtual 
(declaration of 'com.polidea.rxandroidble.internal.radio.RxBleRadioImpl' 
appears in /data/app/es.ralcaidev.arduinobt-2/base.apk)
at com.polidea.rxandroidble.internal.radio.RxBleRadioImpl.access$lambda$0(Unknown)
at com.polidea.rxandroidble.internal.radio.RxBleRadioImpl$$Lambda$1.run(Unknown)
at java.lang.Thread.run(Thread.java:818)

I've switched to JDK 1.8 and enabled Jack on gradle.

Any ideas?

  • Haven't encountered this one. Someone had a similar problem here: https://github.com/Polidea/RxAndroidBle/issues/33 Maybe adding Retrolambda will help? – Dariusz Seweryn Aug 12 '16 at 20:57
  • Could you include your `build.gradle` files? It seems that there is a problem with the setup of the project. – Dariusz Seweryn Aug 16 '16 at 11:41

1 Answers1

2

I had the exact same problem. As s_noopy said, https://github.com/Polidea/RxAndroidBle/issues/33 solved it for me.

The problem is that Java 8 lambdas don't work with RxAndroidBle. You must use retrolambda because of the API versions it is compatible with. This is the reason for the cryptic message stating that the wrong parameter was passed.

In your build.gradle file, remove the jackOptions closure (I believe it is found in the closure defaultConfig) and make it look like this:

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:3.2.5'
    }
}

android {

Let me know if it solves it for you.

KG6ZVP
  • 3,610
  • 4
  • 26
  • 45