Search code examples
androidandroid-studioandroid-gradle-pluginandroid-buildsmooch

Android Studio, cannot find symbol method from already added dependency


I have a weird problem when compiling my project in Android studio. I have two dependencies that kind of affect each other. When I have,

compile 'com.github.dbachelder:CreditCardEntry:1.4.7'

the project compiles fine and works great. However, if I add,

compile 'io.smooch:ui:latest.release'

and compile project again, the methods from firstly added dependency

(com.github.dbachelder:CreditCardEntry:1.4.7) cannot be found.

I attempted:

clean,
rebuild,
./gradlew clean && ./gradlew build,
Sync with Gradle Files,
Closing Android Studio and re-opening,
Invalidate caches & restart,
I even tried to import the CreditCardEntry repo to project manually.

If, I remove the dependency
compile 'io.smooch:ui:latest.release'
Again project compiles fine and find the methods of CreditCardEntry dependency.

The error:

Error:(160, 16) error: cannot find symbol method clearForm()

Error:(161, 16) error: cannot find symbol method setOnCardValidCallback(CardValidCallback)

Error:(163, 16) error: cannot find symbol method focusCreditCard()

Any help appreciated..


Solution

  • io.smooch.ui actually contains com.devmarvel.creditcardentry as an embedded dependency, and it's using the same namespace. My first hunch would be that you have a namespace conflict.

    This feels like a bug on the Smooch SDK side, the embedded dependency probably should be re-namespaced to avoid conflicts like this. (Disclaimer: I work on Smooch, I'll file a bug on our end)

    An immediate workaround that might work is to remove your com.github.dbachelder:CreditCardEntry:1.4.7 package for now and see if you can resolve com.devmarvel.creditcardentry.CreditCardEntry and com.devmarvel.creditcardentry.CreditCardForm from the Smooch UI package instead.