1. Install NDK
To implement screen navigation, I installed react-native-screens along with other related packages. However, I ran into a build error during the process.
The root cause was that Android requires the NDK (Native Development Kit) to execute native code. Without a properly configured NDK, some native modules fail to build.
After installing an NDK version compatible with my Gradle setup, the issue with react-native-screens was successfully resolved.
2. Edit Environment Variables
While downloading various packages and editing environment variables for my React Native project, I accidentally modified some user variables that were already set.
After saving the changes, I couldn’t remember the original paths. As a result, I had to manually locate each one and restore them.
3. Error in MainActivity
While fixing some errors, I learned that I needed to modify MainActivity. I made the changes and tried to build the project again, but it failed.
I realized I had made a mistake in the code, so I got help from Google and ChatGPT. After correcting the issue, I was able to implement a MainActivity that worked properly.
package com.myreact
import android.os.Bundle
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
class MainActivity : ReactActivity() {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun getMainComponentName(): String = "MyReact"
/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
}
Top comments (0)