Docs

Configuration

Configure the generated package, KMP Maven coordinates and the Kotlin version used by Expo Android.

On this page

Generated package#

Tell the plugin where to generate the package, inside the React Native app:

kotlin
rn2kmp {
    packageDirectory = file("../../react-native/packages/react-native-kmp")
    packageName = "react-native-kmp" // npm name. Default: react-native-<module name>, so react-native-shared here
}

In the root build.gradle.kts, set a group and a version so that the generated package can import the module:

kotlin
allprojects {
    group = "com.example.myapp" // your own
    version = "1.0.0"
}

The path is relative to the KMP module. Keep the output inside the React Native project. packageName controls the JavaScript import and can differ from the directory name. Use the same values when generating, installing and importing the package. Gradle plugin options

Expo Android Kotlin version#

For an Android build, set a Kotlin version compatible with your Kotlin Multiplatform app. With Expo:

bash
npx expo install expo-build-properties
json
{
  "expo": {
    "plugins": [
      ["expo-build-properties", { "android": { "kotlinVersion": "2.4.0" } }]
    ]
  }
}

The demos use 2.4.0 on the Expo side with Kotlin 2.4.21 in the KMP module. Choose a version compatible with your library and Android toolchain. Merge the plugin entry into the existing Expo config, apply it with npx expo prebuild --platform android if your app uses Prebuild, then rebuild the development client. Expo BuildProperties