https://kotlinlang.org logo
z

ZabGo

04/21/2020, 10:29 AM
Hello, I am new to Kotlin Multiplatform. I want to make a mobile app in ios and android. I am trying to implement a third party library written in C/C++. I want to create the following function in androidMain :
Copy code
fun setContext(currentActivity: Activity){
	connector.setUIContext(currentActivity) // this function is from the third party library
}
I wonder how I could access the type Activity. It looks it does not recognise it or the android api is not accessible. Do I need to add anything in the build.gradle.kts? Thanks for your help
m

magnumrocha

04/21/2020, 10:53 AM
you should config the android target in your gradle file, to setup an android lib, just like you would config in a android gradle prroject
z

ZabGo

04/21/2020, 12:24 PM
all right make sense. Thank you very much I'll do that then.
z

ZabGo

04/21/2020, 1:19 PM
@Kris Wong thanks so much. That's exactly what I was looking for. I think you just saved me a lot of time :)
k

Kris Wong

04/21/2020, 1:33 PM
that is the point indeed!
2 Views