Android Library project throws java.lang.NoClassDefFoundError: Failed resolution of: Lrx/Observer;

962 views
Skip to first unread message

Chethan Murthy

unread,
Mar 6, 2017, 2:21:40 AM3/6/17
to RxJava

Hi,
I have a library which makes use of Rx and I am packing this library as an aar which can be used in other projects. I am able to generate the aar but when I try to access it in other projects, it throws
java.lang.NoClassDefFoundError: Failed resolution of: Lrx/Observer;

Caused by: java.lang.ClassNotFoundException: Didn't find class "rx.Observer" on path: DexPathList

Maybe I am writing the build.gradle wrong or not excluding some things. Any help is much appreciated.

My library's build.gradle looks like this


compile 'io.reactivex:rxandroid:1.0.1'
compile 'io.reactivex:rxjava:1.0.14'
Can we use Rx in a library project and export it as an aar? Any help is much appreciated.

Jake Wharton

unread,
Mar 6, 2017, 1:40:07 PM3/6/17
to Chethan Murthy, RxJava

If you publish the AAR to a Maven repository its pom will include the RxJava dependency. Otherwise you have to add the dependencies anywhere you manually import the AAR.

Chethan

unread,
Mar 7, 2017, 11:07:07 AM3/7/17
to Jake Wharton, RxJava
Hey, 
Thanks man! It worked! I have never published to maven before. 

Also, thanks for those wonderful libraries you have created. I absolutely love and use a lot of them. 
Reply all
Reply to author
Forward
0 new messages