Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

NoClassDefFoundError #21

Closed
joe85 opened this issue Sep 20, 2017 · 4 comments
Closed

NoClassDefFoundError #21

joe85 opened this issue Sep 20, 2017 · 4 comments

Comments

@joe85
Copy link

joe85 commented Sep 20, 2017

On a new Android project using the dependency from jcenter()

compile "de.mannodermaus.rxjava2:rxbonjour:2.0.0-beta1"

I get

java.lang.NoClassDefFoundError: de.mannodermaus.rxbonjour.discovery.SupportBonjourDiscovery$1$2

when I use

        RxBonjour.newDiscovery(this, "_http._tcp")
                .subscribeOn(Schedulers.io())
                .subscribe({ it ->
                    val item = it.service
                    val type = if (it.type == ADDED) "Added" else "Removed"
                    Log.v("DiscoveryService", "$type: ${item.name} @  ${item.host}:${item.port}")

                }, {
                    Log.e("DiscoveryService", it.message)
                })
@joe85
Copy link
Author

joe85 commented Sep 20, 2017

compile "de.mannodermaus.rxjava:rxbonjour:1.0.0" works fine for me though.

@mannodermaus
Copy link
Owner

mannodermaus commented Sep 28, 2017

Thanks for raising the issue. The problem is likely caused by incorrect artifact details published into the POM of the library. I assume that you can't see the transitive dependency on jmdns in the IDE after pulling in the 2.0.0-beta1 artifact (check in the Project panel when scrolling down to the bottom and expanding "External Libraries")?

It seems like the deployed POMs are completely missing the <dependencies> block. It's very weird that it works on 1.0.0 for you, though, since I can reproduce a similar behaviour with that version as well (ClassNotFoundException on some dependency class).

I'm going to investigate the generation of the Maven artifact & POM details. Maybe it's an issue with how the new dependency configurations work in the Android Gradle Plugin (I don't want to leak the transitive dependency on JmDNS anymore, for instance, which is why it's declared as implementation on the library side). I'll keep you posted! In the meantime, you might be able to resolve the issue by explicitly declaring the dependencies yourself alongside RxBonjour:

// Gradle Plugin 2.x:
compile "de.mannodermaus.rxjava2:rxbonjour:2.0.0-beta1"
apk "org.jmdns:jmdns:+"

// Gradle Plugin 3.x:
implementation "de.mannodermaus.rxjava2:rxbonjour:2.0.0-beta1"
runtimeOnly "org.jmdns:jmdns:+"

@mannodermaus
Copy link
Owner

mannodermaus commented Sep 28, 2017

I have confirmed the issue to be a problem with the android-maven-publish plugin (ref: wupdigital/android-maven-publish#2), where it wouldn't include the <dependencies> block with Gradle 4 and Android Gradle Plugin 3. Upgrading to the latest snapshot works, however - I'm going to lock the local dependency to the latest commit via Jitpack & re-deploy a hotfix. Thank you for your patience, and making me aware of this!

@mannodermaus
Copy link
Owner

This has been released as 1.0.1 & 2.0.0-beta2, respectively.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants