-1

i'm migrating an app from a single module app to a multimodule app. Im following this structure:

[Core] -> [App] -> [Feature]

I created the core module and the feature called wallet, using the File -> new -> new Module option in Android Studio and selected Android library.

In my core module i don't include any dependencies from the other modules, in my build.gradle from app i already included it using the following:

implementation project(":core")
implementation project(":wallet")

in my build.gradle from wallet which is the feature module, i included.

implementation project(':core')

And finally i can see they're in the settings.gradle

include ':app', ':core', ':wallet'
import com.mycompany.core.data.repository.WalletRepository

class WalletUseCaseImpl(walletRepository: WalletRepository) : WalletUseCase {
    override fun getSavedOffers(): Boolean {
        return true
    }
}

I created a WalletUseCaseImpl which implements an interface, in the constructor i want to pass a repository let's call it WalletRepository when i'm typing the AndroidStudio suggest to import it. So i assume the Android Studio recognize the module dependencies.

Android Studio add this import, which is correct i can use cmd + b to go to the file and that's the file i'm using, everything is good.

This is the import: import com.companyname.core.data.repository.WalletRepository

The problem comes when i hit build i'm getting this errors from the Kotlin Compiler:

/Users/myuser/companyprojectname/wallet/src/main/java/com/example/wallet/data/usecase/WalletUseCaseImpl.kt: (3, 24): ** Unresolved reference: data **

Unresolved reference: OffersRepository

Things that i already do: Invalidate Cache/Restart ./gradlew clean ./gradlew build

Thanks in advance.

RandomCoder
  • 141
  • 1
  • 2
  • 8

1 Answers1

-1

I actually solved it, the problem was my build.gradle (Core Module) was missing kotlin plugin, i don't know why.

Before:

apply plugin: 'com.android.library'

After:

apply plugin: 'com.android.library'
apply plugin: "com.github.ben-manes.versions"
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

In dependencies:

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
RandomCoder
  • 141
  • 1
  • 2
  • 8