From 0cabd3f2fc9fd12a48a6279f9f2388bb7884700b Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 25 Apr 2022 11:10:39 -0700 Subject: [PATCH] link mqtt client version and min sdk via boolean Looking to have a separate branch for older devs --- xwords4/android/app/build.gradle | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index dcb43f94e..e4f2729b6 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -19,10 +19,20 @@ */ def INITIAL_CLIENT_VERS = 10 -def VERSION_CODE_BASE = 182 +def VERSION_CODE_BASE = 182 // <-- increase by 2 each time while using + // HAS_CURRENT_MQTT below def VERSION_NAME = '4.4.185' def BUILD_INFO_NAME = "build-info.txt" +// Trying to support older devices (pre KitKat) while moving KitKat and beyond +// to the newer version of the Paho MQTT client library that, with luck, will +// crash less. I'll add a new branch that differs from android_branch only in +// whether HAS_CURRENT_MQTT is true or false. +def HAS_CURRENT_MQTT = true +if ( HAS_CURRENT_MQTT ) { + VERSION_CODE_BASE += 1; +} + // Not all variants use the same BT_UUID. Those with the same talk to // each other def XW_UUID = '"7be0d084-ff89-4d6d-9c78-594773a6f963"' // from comms.h @@ -61,8 +71,11 @@ android { ndkVersion '21.4.7075529' defaultConfig { // HostApduService requires 19. But is it a problem? - // minSdkVersion 14 - minSdkVersion 19 // Required for paho client > 3:1.1.+ + if ( HAS_CURRENT_MQTT ) { + minSdkVersion 19 // Required for paho client > 3:1.1.+ + } else { + minSdkVersion 14 + } targetSdkVersion 30 // must match ../build.gradle versionCode VERSION_CODE_BASE versionName VERSION_NAME @@ -366,8 +379,11 @@ dependencies { // 3:1.2.+ crashes on API 18 and below (all Jelly Beans) because // java.nio.charset.StandardCharsets not defined. Does not crash on // 19 (KitKat). - implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.+" - // implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.+" + if ( HAS_CURRENT_MQTT ) { + implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.+" + } else { + implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.+" + } implementation 'com.google.zxing:core:3.3.+' }