Finally after a lot of trials managed to do this. These are the steps.
- 1) Using this link, export android project for Gradle.
Select Gradle in the Build Settings window and check the Export Project checkbox.
Click Export and select the destination folder. - 2) Import the generated folder in Android studio. Select ok whenever prompted. In this process, you will encounter following issues
- 2a) Gradle Sync Failed due to org.gradle.api.internal.tasks issues. Resolve using this link
- 3) Create React Native App using this link
- 4) Start Integrating Android exported folder inside created react native app using this link. Don’t upgrade Gradle as Android studio will ask you again and again. You will encounter following issues. Don’t go through “Test Integration” until you are finished with #5 here.
- 4a) While configuring maven, use this url for maven url “$rootDir/../node_modules/react-native/android” .
- 4b) While configuring maven, if you encounter problem related to javax.inject:javax.inject”. Use this link.
- 4c) You may also encounter this error “Conflict with dependency ‘com.google.code.findbugs:jsr305′”. You can solve this link.
- 4d) During Code integration section of this link, focus on the following section: If you are using a starter kit for React Native, replace the “HelloWorld” string with the one in your index.android.js file (it’s the first argument to the AppRegistry.registerComponent() method). Here you have to replace with project name.
- 5) Before going through “Test your Integration” section, you have to add code to call MyReactActivity from UnityActivity. This link will help.
- 6) Go through “Test your Integration” section of link provided in #4. You may encounter following problems.
- 6a) unable to load script from assets index.android.bundle. Use this link.
- 6b) could not connect to development server on android. Use this link.