androidkotlinokhttp

Kotlin Android Crashes when the OkHttp Request is created


I have created a Module for Network calls. It works well when tested on the same Project for all API methods. But When I add it as a dependency on another project it fails When a request is created.

return Request.Builder()
            .url(urlObj)
            .build()

FATAL EXCEPTION: Thread-2
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Request$Builder;

(I am new to Android. I have only 3 days of Android and Kotlin experience )

Project Location: https://github.com/manoj86/aOS_iNetwork


Solution

  • So the problem is local aar would not download the dependencies defined in it when they are added to other local projects.

    They are downloaded when the library is published to Maven and imported from there.

    All the dependencies are to be added again to the project that included the local arr as library.