hivemq-mqtt-client
hivemq-mqtt-client copied to clipboard
AGP 8.0 java.lang.NoClassDefFoundError: ExternalSyntheticLambda2
Platform: Android 19
build.gradle: minSdkVersion : 19 compileSdkVersion = 33 targetSdkVersion = 33 buildToolsVersion = '33.0.1'
Retrofix : classpath 'com.github.sgtsilvio.gradle:android-retrofix:0.5.0' implementation "net.sourceforge.streamsupport:android-retrostreams:1.7.4" implementation "net.sourceforge.streamsupport:android-retrofuture:1.7.4"
hivemq : implementation "com.hivemq:hivemq-mqtt-client-websocket:1.3.1"
Application is crashing after upgrading to Android Gradle Plugin from 7.4 to 8.0
`Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttClientTransportConfigImplBuilder$$ExternalSyntheticLambda1> 18:12:54.480 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttClientTransportConfigImplBuilder$$ExternalSyntheticLambda1> 18:12:54.484 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttClientTransportConfigImplBuilder$$ExternalSyntheticLambda2> 18:12:54.484 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttClientTransportConfigImplBuilder$$ExternalSyntheticLambda2> 18:12:54.485 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttClientTransportConfigImplBuilder$$ExternalSyntheticLambda0> 18:12:54.486 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttClientTransportConfigImplBuilder$$ExternalSyntheticLambda0> 18:12:54.498 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase$$ExternalSyntheticLambda2> 18:12:54.498 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase$$ExternalSyntheticLambda2> 18:12:54.501 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase$$ExternalSyntheticLambda0> 18:12:54.501 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase$$ExternalSyntheticLambda0> 18:12:54.502 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase$$ExternalSyntheticLambda1> 18:12:54.504 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase$$ExternalSyntheticLambda1> 18:12:54.530 I Rejecting re-init on previously-failed class java.lang.Class<io.netty.util.internal.LongAdderCounter> 18:12:54.530 I Rejecting re-init on previously-failed class java.lang.Class<io.netty.util.internal.LongAdderCounter> 18:12:54.579 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilder$$ExternalSyntheticLambda0> 18:12:54.579 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilder$$ExternalSyntheticLambda0> 18:12:54.581 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilder$$ExternalSyntheticLambda1> 18:12:54.581 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilder$$ExternalSyntheticLambda1> 18:12:54.583 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilder$$ExternalSyntheticLambda2> 18:12:54.583 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClientBuilder$$ExternalSyntheticLambda2> 18:12:54.592 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClient$$ExternalSyntheticLambda3> 18:12:54.592 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClient$$ExternalSyntheticLambda3> 18:12:54.594 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClient$$ExternalSyntheticLambda2> 18:12:54.595 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClient$$ExternalSyntheticLambda2> 18:12:54.606 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClient$$ExternalSyntheticLambda4> 18:12:54.606 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClient$$ExternalSyntheticLambda4> 18:12:54.607 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClient$$ExternalSyntheticLambda1> 18:12:54.607 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClient$$ExternalSyntheticLambda1> 18:12:54.608 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClient$$ExternalSyntheticLambda5> 18:12:54.608 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttRxClient$$ExternalSyntheticLambda5> 18:12:54.614 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.util.collections.ImmutableElement$ElementSpliterator> 18:12:54.614 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.util.collections.ImmutableElement$ElementSpliterator> 18:12:54.627 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttAsyncClient$$ExternalSyntheticLambda5> 18:12:54.627 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttAsyncClient$$ExternalSyntheticLambda5> 18:12:54.629 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttAsyncClient$$ExternalSyntheticLambda3> 18:12:54.629 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttAsyncClient$$ExternalSyntheticLambda3> 18:12:54.630 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttAsyncClient$$ExternalSyntheticLambda1> 18:12:54.631 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttAsyncClient$$ExternalSyntheticLambda1> 18:12:54.636 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttAsyncClient$$ExternalSyntheticLambda0> 18:12:54.637 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.MqttAsyncClient$$ExternalSyntheticLambda0> 18:12:54.639 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.message.subscribe.MqttSubscriptionBuilder$$ExternalSyntheticLambda0> 18:12:54.639 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.message.subscribe.MqttSubscriptionBuilder$$ExternalSyntheticLambda0> 18:12:54.641 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.message.subscribe.MqttSubscribeBuilder$$ExternalSyntheticLambda2> 18:12:54.641 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.message.subscribe.MqttSubscribeBuilder$$ExternalSyntheticLambda2> 18:12:54.642 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.message.subscribe.MqttSubscribeBuilder$$ExternalSyntheticLambda3> 18:12:54.642 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.message.subscribe.MqttSubscribeBuilder$$ExternalSyntheticLambda3> 18:12:54.643 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.message.subscribe.MqttSubscribeBuilder$$ExternalSyntheticLambda3> 18:12:54.643 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.message.subscribe.MqttSubscribeBuilder$$ExternalSyntheticLambda1> 18:12:54.644 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.message.subscribe.MqttSubscribeBuilder$$ExternalSyntheticLambda1> 18:12:54.645 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.message.subscribe.MqttSubscribeBuilder$$ExternalSyntheticLambda0> 18:12:54.645 I Rejecting re-init on previously-failed class java.lang.Class<com.hivemq.client.internal.mqtt.message.subscribe.MqttSubscribeBuilder$$ExternalSyntheticLambda0> 18:12:54.648 I Rejecting re-init on previously-failed class
@SgtSilvio Can you please help me? Its blocking!
Please share more information like minSdkVersion and Android version of your test device. Also, do you use the android-retrofix plugin? If so, which version? Did you update to the latest version (0.5.0)?
@SgtSilvio Updated the comment
build.gradle:
minSdkVersion : 19
compileSdkVersion = 33
targetSdkVersion = 33
buildToolsVersion = '33.0.1'
Retrofix :
classpath 'com.github.sgtsilvio.gradle:android-retrofix:0.5.0'
implementation "net.sourceforge.streamsupport:android-retrostreams:1.7.4"
implementation "net.sourceforge.streamsupport:android-retrofuture:1.7.4"
hivemq : implementation "com.hivemq:hivemq-mqtt-client-websocket:1.3.1"
Can you share your build file. Do you have everthikg configured as documented here: https://hivemq.github.io/hivemq-mqtt-client/docs/installation/android/
@SgtSilvio I have configured everything as in https://hivemq.github.io/hivemq-mqtt-client/docs/installation/android/ Please find build.gradle files below
project/library build.gradle
apply plugin: 'com.android.library'
apply from: '../../constants.gradle'
android {
compileSdkVersion project.ext.compileSdkVersion
defaultConfig {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
consumerProguardFiles 'proguard-rules.pro'
vectorDrawables.useSupportLibrary = true
}
packagingOptions {
resources {
excludes += ['META-INF/DEPENDENCIES.txt', 'META-INF/NOTICE.txt', 'META-INF/LICENSE.txt', 'META-INF/LICENSE']
}
}
flavorDimensions "default"
productFlavors {
dev {
setVersionName("DEV-" + rootProject.ext.releaseVersionName)
}
staging {
setVersionName("STAGING-" + rootProject.ext.releaseVersionName)
}
production {}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
dummy {
initWith release
}
}
configurations {
all*.exclude group: 'com.google.android', module: 'android'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lint {
abortOnError true
checkReleaseBuilds true
}
namespace 'com.xxx.xxx.xxx'
// testOptions.unitTests.includeAndroidResources true
libraryVariants.all { variant ->
variant.outputs.all {
outputFileName = "xxx-${variant.flavorName}-release.aar"
}
tasks.all { task ->
if (task.name == "publish${variant.flavorName.capitalize()}PublicationToMavenLocal" ||
task.name == "publish${variant.flavorName.capitalize()}PublicationToXXXRepository") {
task.dependsOn "assemble${variant.flavorName.capitalize()}Release"
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
implementation "com.squareup.okhttp3:okhttp:$project.ext.okHttpVersion"
implementation "com.hivemq:hivemq-mqtt-client-websocket:$project.ext.hivemqLibVersion"
implementation "androidx.localbroadcastmanager:localbroadcastmanager:$project.ext.supportXLibVersion"
implementation "com.github.bumptech.glide:glide:$project.ext.glideVersion"
implementation "com.github.kenglxn.QRGen:android:$project.ext.qRGenVersion"
api "com.google.protobuf:protobuf-java:$project.ext.protobufJavaVersion"
api "com.google.android.material:material:$project.ext.materialVersion"
api "com.github.tony19:logback-android:$project.ext.tonyLogbackVersion"
api("com.papertrailapp:logback-syslog4j:$project.ext.papertrailVersion") {
exclude group: 'ch.qos.logback'
}
api "com.google.guava:guava:$project.ext.guavaVersion"
implementation "com.google.android.gms:play-services-location:$project.ext.playServicesLocationVersion"
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.9'
testImplementation 'org.mockito:mockito-core:4.5.1'
testImplementation 'androidx.test:core:1.5.0'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test:rules:1.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
}
project/app build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.github.sgtsilvio.gradle.android-retrofix'
apply from: '../constants.gradle'
def compileSdkVer = project.ext.compileSdkVersion
def buildToolsVer = project.ext.buildToolsVersion
android {
compileSdkVersion compileSdkVer
buildToolsVersion buildToolsVer
defaultConfig {
applicationId "xxx"
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
versionName rootProject.ext.releaseVersionName
versionCode rootProject.ext.releaseVersionCode
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
vectorDrawables.useSupportLibrary = true
}
packagingOptions {
resources {
excludes += ['META-INF/DEPENDENCIES.txt', 'META-INF/NOTICE.txt', 'META-INF/LICENSE.txt', 'META-INF/LICENSE', 'META-INF/INDEX.LIST', 'META-INF/io.netty.versions.properties']
}
}
signingConfigs {
debug {
storeFile file("debug.keystore")
}
release {
storeFile file(System.getenv("xxx"))
storePassword System.getenv("xxx")
keyAlias System.getenv("xxx")
keyPassword System.getenv("xxx")
}
}
flavorDimensions "default"
productFlavors {
dev {
setVersionName("DEV-" + rootProject.ext.releaseVersionName)
applicationIdSuffix ".dev"
}
staging {
setVersionName("STAGING-" + rootProject.ext.releaseVersionName)
applicationIdSuffix ".staging"
}
production {}
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
dummy {
initWith release
versionNameSuffix "-DUMMY"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lint {
abortOnError true
checkReleaseBuilds true
}
namespace 'xxx'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':xxx')
implementation "net.sourceforge.streamsupport:android-retrostreams:$project.ext.retrostreamsVersion"
implementation "net.sourceforge.streamsupport:android-retrofuture:$project.ext.retrostreamsVersion"
implementation "com.google.firebase:firebase-crashlytics:$project.ext.fbCrashlyticsVersion"
implementation "com.google.firebase:firebase-analytics:$project.ext.fbAnalyticsVersion"
implementation "androidx.lifecycle:lifecycle-process:$project.ext.lifecycleVersion"
implementation "androidx.multidex:multidex:$project.ext.multidexVersion"
implementation "com.google.android.gms:play-services-base:$project.ext.playServicesBaseVersion"
// debugImplementation because LeakCanary should only run in debug builds.
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
}
project/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.5'
classpath 'gradle.plugin.com.github.sgtsilvio.gradle:android-retrofix:0.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://jitpack.io"
}
// mavenLocal()
}
}
ext {
releaseVersionName = version
releaseVersionCode = project.buildVersionCode()
}
classpath 'gradle.plugin.com.github.sgtsilvio.gradle:android-retrofix:0.4.1'
This line in your project/build.gradle means that you are using 0.4.1 of android-retrofix, and not 0.5.0. Please try to update the version.
@SgtSilvio I tried but getting new error and its not connecting
18:55:05.054 I 18:55:05,059 |-ERROR in ch.qos.logback.core.joran.action.AppenderAction - Could not create an Appender of type [ch.qos.logback.core.FileAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.FileAppender
18:55:05.054 I at ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.FileAppender
18:55:05.054 I at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(Unknown Source)
18:55:05.054 I at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(Unknown Source)
18:55:05.064 I at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(Unknown Source)
18:55:05.064 I at at ch.qos.logback.core.joran.action.AppenderAction.begin(Unknown Source)
18:55:05.064 I at at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Unknown Source)
18:55:05.064 I at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
18:55:05.064 I at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
18:55:05.064 I at at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
18:55:05.064 I at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
18:55:05.064 I at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
18:55:05.064 I at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
18:55:05.064 I at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
18:55:05.064 I at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(Unknown Source)
18:55:05.064 I at at org.slf4j.impl.LoggerServiceProvider.initializeLoggerContext(Unknown Source)
18:55:05.064 I at at org.slf4j.impl.LoggerServiceProvider.initialize(Unknown Source)
18:55:05.064 I at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:183)
18:55:05.074 I at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:170)
18:55:05.074 I at at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:455)
18:55:05.074 I at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:441)
18:55:05.074 I at at io.netty.util.internal.logging.Slf4JLoggerFactory.<init>(Slf4JLoggerFactory.java:42)
18:55:05.074 I at at io.netty.util.internal.logging.InternalLoggerFactory.newDefaultFactory(InternalLoggerFactory.java:44)
18:55:05.074 I at at io.netty.util.internal.logging.InternalLoggerFactory.getDefaultFactory(InternalLoggerFactory.java:69)
18:55:05.074 I at at io.netty.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:92)
18:55:05.074 I at at io.netty.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:85)
18:55:05.074 D Setting up flushing for Thread[UploadHandlerThread,5,main]
18:55:05.084 D Setting up flushing for Thread[LeakCanary-Heap-Dump,5,main]
18:55:05.084 I at at io.netty.util.internal.SystemPropertyUtil.<clinit>(SystemPropertyUtil.java:29)
18:55:05.084 I at at io.netty.util.NetUtil.<clinit>(NetUtil.java:125)
18:55:05.084 I at at com.hivemq.client.internal.util.InetSocketAddressUtil.create(InetSocketAddressUtil.java:32)
18:55:05.084 I at at com.hivemq.client.internal.mqtt.MqttClientTransportConfigImpl.<clinit>(MqttClientTransportConfigImpl.java:34)
18:55:05.084 I at at com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase.<init>(MqttRxClientBuilderBase.java:46)
18:55:05.084 I at at com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase$Choose.<init>(MqttRxClientBuilderBase.java:216)
18:55:05.084 I at at com.hivemq.client.mqtt.MqttClient$-CC.builder(MqttClient.java:59)
18:55:05.084 I at at com.x.x.x.x.y.initMqtt(x.java:47)
18:55:05.084 I at at com.x.x.x.x.x.initMqtt(x.java:39)
18:55:05.084 I at at com.x.x.x.x.lambda$initCommAsync$0(x.java:65)
18:55:05.084 I at at com.x.x.x.x.$r8$lambda$Pb04Zbq33uHlz8E5QRw5cE3Gg0M(x.java:0)
18:55:05.084 I at at com.x.x.x.x$$ExternalSyntheticLambda0.run(R8$$SyntheticClass:0)
18:55:05.084 I at at com.x.x.x$x$1.run(x.java:92)
18:55:05.084 I at at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
18:55:05.084 I at at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
18:55:05.084 I at at java.lang.Thread.run(Thread.java:841)
@SgtSilvio I think the root cause is this error. Its not able to connect to the broker
Could not find method javax.net.ssl.SSLParameters.setEndpointIdentificationAlgorithm, referenced from method com.hivemq.client.internal.mqtt.MqttClientSslConfigImpl$$ExternalSyntheticApiModelOutline0.m
Get the same error as rohit5ram.
I updated gradle from 7.4.2 to 8.0.2.
Using HiveMQ-Client 1.3.2 (also tested with 1.3.0 which worked under gradle 7.4.2) and android-retrofix 0.5.0.
Our minSDK is 23.
Seems to work fine on android 9 but throw the error on android 6 devices.
Log:
2023-09-13 10:12:38.144 System.err W java.lang.NoClassDefFoundError: com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase$$ExternalSyntheticLambda1
2023-09-13 10:12:38.144 System.err W at com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase.transportConfig(MqttRxClientBuilderBase.java:131)
2023-09-13 10:12:38.144 System.err W at com.hivemq.client.internal.mqtt.MqttRxClientBuilder.transportConfig(MqttRxClientBuilder.java:39)
2023-09-13 10:12:38.144 System.err W at .service.MQTTBroadcastReceiverService.onHandleIntent(MQTTBroadcastReceiverService.java:122)
2023-09-13 10:12:38.144 System.err W at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
2023-09-13 10:12:38.144 System.err W at android.os.Handler.dispatchMessage(Handler.java:102)
2023-09-13 10:12:38.144 System.err W at android.os.Looper.loop(Looper.java:148)
2023-09-13 10:12:38.144 System.err W at android.os.HandlerThread.run(HandlerThread.java:61)
2023-09-13 10:12:38.242 System.out I ERROR:com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase$$ExternalSyntheticLambda1 | UncaughtException | java.lang.NoClassDefFoundError: com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase$$ExternalSyntheticLambda1
2023-09-13 10:12:38.242 System.out I at com.hivemq.client.internal.mqtt.MqttRxClientBuilderBase.transportConfig(MqttRxClientBuilderBase.java:131)
2023-09-13 10:12:38.242 System.out I at com.hivemq.client.internal.mqtt.MqttRxClientBuilder.transportConfig(MqttRxClientBuilder.java:39)
2023-09-13 10:12:38.242 System.out I at .service.MQTTBroadcastReceiverService.onHandleIntent(MQTTBroadcastReceiverService.java:122)
2023-09-13 10:12:38.242 System.out I at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
2023-09-13 10:12:38.242 System.out I at android.os.Handler.dispatchMessage(Handler.java:102)
2023-09-13 10:12:38.242 System.out I at android.os.Looper.loop(Looper.java:148)
2023-09-13 10:12:38.242 System.out I at android.os.HandlerThread.run(HandlerThread.java:61)
Fixed, just forget to change this:
implementation 'net.sourceforge.streamsupport:android-retrostreams:1.7.4'
implementation 'net.sourceforge.streamsupport:android-retrofuture:1.7.4'
to
retrofix('net.sourceforge.streamsupport:android-retrostreams:1.7.4')
retrofix('net.sourceforge.streamsupport:android-retrofuture:1.7.4')
@SgtSilvio I still face the issue. I cannot upgrade to AGP 8.0 anymore. Can you please help? After following all suggestions mentioned above I am stuck with the below error,
An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.IllegalStateException: unknown type parameter 'I': class io.netty.handler.codec.MessageToMessageEncoder
at io.netty.util.internal.TypeParameterMatcher.find0(TypeParameterMatcher.java:92)
at io.netty.util.internal.TypeParameterMatcher.find(TypeParameterMatcher.java:68)
at io.netty.handler.codec.MessageToMessageEncoder.<init>(MessageToMessageEncoder.java:61)
at io.netty.handler.codec.http.HttpObjectEncoder.<init>(HttpObjectEncoder.java:54)
at io.netty.handler.codec.http.HttpRequestEncoder.<init>(HttpRequestEncoder.java:28)
at io.netty.handler.codec.http.HttpClientCodec$Encoder.<init>(HttpClientCodec.java:184)
at io.netty.handler.codec.http.HttpClientCodec$Encoder.<init>(HttpClientCodec.java:184)
at io.netty.handler.codec.http.HttpClientCodec.<init>(HttpClientCodec.java:107)
at io.netty.handler.codec.http.HttpClientCodec.<init>(HttpClientCodec.java:97)
at io.netty.handler.codec.http.HttpClientCodec.<init>(HttpClientCodec.java:88)
at io.netty.handler.codec.http.HttpClientCodec.<init>(HttpClientCodec.java:72)
at com.hivemq.client.internal.mqtt.handler.websocket.MqttWebSocketInitializer.initChannel(MqttWebSocketInitializer.java:79)
at com.hivemq.client.internal.mqtt.handler.MqttChannelInitializer.initWebsocket(MqttChannelInitializer.java:132)
at com.hivemq.client.internal.mqtt.handler.MqttChannelInitializer.$r8$lambda$Fb7Tg2iI9qY_qsy1VA-0JRzlMik(MqttChannelInitializer.java:0)
at com.hivemq.client.internal.mqtt.handler.MqttChannelInitializer$$ExternalSyntheticLambda2.accept(R8$$SyntheticClass:0)
at com.hivemq.client.internal.mqtt.handler.ssl.MqttSslAdapterHandler.handshakeComplete(MqttSslAdapterHandler.java:76)
at com.hivemq.client.internal.mqtt.handler.ssl.MqttSslAdapterHandler.userEventTriggered(MqttSslAdapterHandler.java:63)
at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:400)
at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:376)
at io.netty.channel.AbstractChannelHandlerContext.fireUserEventTriggered(AbstractChannelHandlerContext.java:368)
at io.netty.handler.ssl.SslHandler.setHandshakeSuccess(SslHandler.java:1936)
at io.netty.handler.ssl.SslHandler.wrapNonAppData(SslHandler.java:998)
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1507)
at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1334)
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1383)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
21:11:29.012 W at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:923)
@SgtSilvio Finally it worked with below Proguard rules!
#HiveMQ
-keepclassmembernames class io.netty.** { *; }
-keepclassmembers class org.jctools.** { *; }
-keep class io.netty.handler.codec.** { *; }