voize-gmbh / reakt-native-toolkit

Combine React Native with Kotlin Multiplatform (KMP)
Apache License 2.0
134 stars 5 forks source link

Add FAQ and/or documentation #9

Closed friedger closed 1 year ago

friedger commented 1 year ago

I am struggling using reakt-native-toolkit.

I get an error and I can't find information where to add the dependency

Execution failed for task ':shared:mapReleaseSourceSetPaths'.
> Could not resolve all files for configuration ':shared:releaseRuntimeClasspath'.
   > Could not find com.facebook.react:react-native:0.69.4.
     Required by:
         project :shared > de.voize:reakt-native-toolkit:0.2.0 > de.voize:reakt-native-toolkit-android:0.2.0
Legion2 commented 1 year ago

We currently require react-native 0.69.4, if your project uses a different version, you get this error. @friedger which version of react native do you use?

friedger commented 1 year ago

Initially the shared module does not agree any dependencies to react-native. I'm confused how to add it so that gradlew shared:build works.

Legion2 commented 1 year ago

Because the android react-native dependency is not available in any public maven repository, the are distributed in the npm package of react-native. But they only include one version. If you get an error telling you react-native could not be found, it is most likely that you have not setup the react-native project correctly, or you have a version mismatch between the npm react-native package and the version used by this library.

You can check if you have setup the project correctly by looking in the node_modules/react-native/android directory, there should be somewhere the react-native android dependency artifact.

friedger commented 1 year ago

Just to clarify, the react-native project is in a separate module?

Legion2 commented 1 year ago

What do you mean with module? React-native is a separate project https://github.com/facebook/react-native

friedger commented 1 year ago

My project is setup with four modules as follows: |- shared |- androiddemo (using shared) |- iosdemo (using shared) |- rndemo (using shared)

Therefore, I am not sure how to define the dependency of react-native in the shared module

erksch commented 1 year ago

The project setup we are using with the toolkit (and therefore the tested and supported one) is the standard React Native project setup.

This means the project setup should probably be:

root
| - android
     | - app
     | - shared <- KMM code goes here
| - ios
| - src (JS)
package.json

The shared module needs to be added to the /android directory as described in the project setup documentation.

erksch commented 1 year ago

Closing due to inactivity