diff --git a/buildCommon/commonLibConfig.gradle b/buildCommon/commonLibConfig.gradle index f3d3808..4a29c5e 100644 --- a/buildCommon/commonLibConfig.gradle +++ b/buildCommon/commonLibConfig.gradle @@ -62,10 +62,9 @@ project.ext { annotationProcessor : "com.github.bumptech.glide:compiler:${versions.glide}", photo_view : "com.github.chrisbanes:PhotoView:${versions.photo_view}", luban : "top.zibin:Luban:${versions.luban}", - gson : "com.google.code.gson:gson${versions.gson}", + gson : "com.google.code.gson:gson:${versions.gson}", arouter : "com.alibaba:arouter-api:${versions.arouter}", arouter_compiler : "com.alibaba:arouter-compiler:${versions.arouter}", - ] /** diff --git a/commonbt/build.gradle b/commonbt/build.gradle index b2aa365..213a000 100644 --- a/commonbt/build.gradle +++ b/commonbt/build.gradle @@ -23,4 +23,6 @@ dependencies { implementation rootProject.ext.dependencies.kotlin // 添加rxAndroid依赖 implementation rootProject.ext.dependencies.rxandroid + // 添加gson依赖 + implementation rootProject.ext.dependencies.gson } \ No newline at end of file diff --git a/commonbt/src/main/java/com/common/bluetooth/adapter/BluetoothClientBLEAdapter.java b/commonbt/src/main/java/com/common/bluetooth/adapter/BluetoothClientBLEAdapter.java index a65eecf..71ad17a 100644 --- a/commonbt/src/main/java/com/common/bluetooth/adapter/BluetoothClientBLEAdapter.java +++ b/commonbt/src/main/java/com/common/bluetooth/adapter/BluetoothClientBLEAdapter.java @@ -24,9 +24,9 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; -import io.reactivex.Observable; -import io.reactivex.ObservableEmitter; -import io.reactivex.ObservableOnSubscribe; +import io.reactivex.rxjava3.core.Observable; +import io.reactivex.rxjava3.core.ObservableEmitter; +import io.reactivex.rxjava3.core.ObservableOnSubscribe; /** * 蓝牙设备适配器 diff --git a/commonbt/src/main/java/com/common/bluetooth/interfaces/IBluetoothClient.kt b/commonbt/src/main/java/com/common/bluetooth/interfaces/IBluetoothClient.kt index 11c01cb..963d151 100644 --- a/commonbt/src/main/java/com/common/bluetooth/interfaces/IBluetoothClient.kt +++ b/commonbt/src/main/java/com/common/bluetooth/interfaces/IBluetoothClient.kt @@ -3,8 +3,8 @@ package com.common.bluetooth.interfaces import android.bluetooth.BluetoothDevice import com.common.bluetooth.BtConstants.BLUETOOTH_TYPE import com.common.bluetooth.callback.BaseResultCallback -import io.reactivex.Observable -import java.util.* +import io.reactivex.rxjava3.core.Observable +import java.util.UUID /** * 蓝牙客户端接口 diff --git a/commonbt/src/main/java/com/common/bluetooth/service/BLEClientService.java b/commonbt/src/main/java/com/common/bluetooth/service/BLEClientService.java index afdc4db..da5b625 100644 --- a/commonbt/src/main/java/com/common/bluetooth/service/BLEClientService.java +++ b/commonbt/src/main/java/com/common/bluetooth/service/BLEClientService.java @@ -25,9 +25,10 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import io.reactivex.Observable; -import io.reactivex.Observer; -import io.reactivex.disposables.Disposable; +import io.reactivex.rxjava3.core.Observable; +import io.reactivex.rxjava3.core.Observer; +import io.reactivex.rxjava3.disposables.Disposable; + /** * BLE客户端服务 diff --git a/commonbt/src/main/java/com/common/bluetooth/service/BluetoothLeConnector.java b/commonbt/src/main/java/com/common/bluetooth/service/BluetoothLeConnector.java index 8b32339..fbda5e7 100644 --- a/commonbt/src/main/java/com/common/bluetooth/service/BluetoothLeConnector.java +++ b/commonbt/src/main/java/com/common/bluetooth/service/BluetoothLeConnector.java @@ -21,7 +21,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; -import io.reactivex.functions.Consumer; +import io.reactivex.rxjava3.functions.Consumer; + /** * Service for managing connection and data communication with a GATT server @@ -416,7 +417,7 @@ public class BluetoothLeConnector { try { action.accept(gattCharacteristic); - } catch (Exception e) { + } catch (Throwable e) { e.printStackTrace(); } } diff --git a/gradle.properties b/gradle.properties index 6826e61..76356a6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,4 +14,5 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # AndroidX package structure to make it clearer which packages are bundled with the # Android operating system, and which are packaged with your app"s APK # https://developer.android.com/topic/libraries/support-library/androidx-rn -android.useAndroidX=true \ No newline at end of file +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file