https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
n

Nicolas Bourdin

06/30/2020, 9:22 AM
Hello, Is it possible to integrate a kotlin native project (otherKnLib) as project dependencies (source folder) in another kotlin native project (common) ?
Copy code
- rootProject
	- app
	- iOS
	- common
		- src
			- androidMain
			- commonMain
			- ...
		- build.gradle
	- otherKnLib
		- src
			- androidMain
			- commonMain
			- ...
		- build.gradle
	settings.gradle
	build.gradle
I tried to import my lib in the differents sourceSets dependencies in the common module, but I suppose I also have to specify the "target" (common, android, ios) for each sourceSet
Copy code
sourceSets {
	val commonMain by getting {
		implementation(project(":otherKnLib")
	}

	val androidMain by getting {
		implementation(project(":otherKnLib")
	}

	val iosMain by getting {
		implementation(project(":otherKnLib")
	}
}
In this case, when i try to build, i got an
Unresolved reference
Any idea ? Thanks in advance :)
a

andylamax

06/30/2020, 9:45 AM
Yes its possible . . . . Just make sure
project(":otherKnLib")
also has an android and ios target with the same name and preset
👍 2
In short, make sure the dependency can provide implementation all all your targets
r

russhwolf

06/30/2020, 12:01 PM
If the targets match, it should work just by specifying the project dependency in common. Don't worry about also repeating it in each platform's dependencies
3 Views