I am new to Android Developement and I am trying to implement Bluetooth LE features in my application. I have some difficulties running my Android project with RXAndroidBLE. This library uses lambda and I can not start it.
I updated the gradle file:
apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "com.example.maxime.applicationtest" minSdkVersion 18 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" jackOptions { enabled true } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.1.0' testCompile 'junit:junit:4.12' compile "com.polidea.rxandroidble:rxandroidble:1.1.0" }
When I try to run the following code in my MainActivity, an error message is displayed:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RxBleClient rxBleClient = RxBleClient.create(this); Subscription scanSubscription = rxBleClient.scanBleDevices() .subscribe( rxBleScanResult -> {
FATAL EXCEPTION: Thread-4847 Process: com.example.maxime.applicationtest, PID: 27342 java.lang.NoSuchMethodError: No virtual method com_polidea_rxandroidble_internal_radio_RxBleRadioImpl$$Lambda$1_lambda$new$0()V in class Lcom/polidea/rxandroidble/internal/radio/RxBleRadioImpl; or its super classes (declaration of 'com.polidea.rxandroidble.internal.radio.RxBleRadioImpl' appears in /data/app/com.example.maxime.applicationtest-1/base.apk) at com.polidea.rxandroidble.internal.radio.RxBleRadioImpl$$Lambda$1.run(Unknown Source) at java.lang.Thread.run(Thread.java:818)
I do not know why this is going wrong.
If anyone could help me, that would be great. Thanks!
source share