Skip to content

Troubleshooting

Tommy Nguyen edited this page Mar 12, 2024 · 15 revisions

Android NDK: ERROR:/~/android/src/main/jni/Android.mk:fb: LOCAL_SRC_FILES points to a missing file

If you're seeing this build error with newArchEnabled=true, you're likely using a library that doesn't support autolinking TurboModule. Please file an issue in their repo.

  Android NDK: ERROR:/~/node_modules/react-native-safe-area-context/android/src/main/jni/Android.mk:fb: LOCAL_SRC_FILES points to a missing file
  Android NDK: Check that /~/android/app/build/react-ndk/exported/arm64-v8a/libfb.so exists  or that its path is correct

For now, you can build libfb.so manually by invoking Gradle:

./gradlew packageReactNdkDebugLibs

Then retry the command you were using earlier.

Error: Activity class {com.microsoft.reacttestapp/com.microsoft.reacttestapp.MainActivity} does not exist.

If you've changed the application id, react-native run-android will fail. You'll need to tell run-android which id to launch, e.g. to launch com.contoso.MyApp:

yarn react-native run-android --appId com.contoso.MyApp

Error: project.projectFile invalid. Error: No app project file found, please specify in react-native.config.

On react-native-windows 0.63, autolinking seems to no longer respect the --sln flag. We can work around this by manually specifying the project path:

const path = require("path");
const { windowsProjectPath } = require('react-native-test-app');

const windowsSourceDir = "windows";
module.exports = {
  project: {
    windows: {
      sourceDir: windowsSourceDir,
      project: windowsProjectPath(path.join(__dirname, windowsSourceDir)),
    },
  },
  reactNativePath: "node_modules/react-native-windows",
};

Failed to construct transformer : error : EBUSY: resource busy or locked, open '~\msbuild.ProjectImports.zip'

This is a known issue in MSBuild (/dotnet/msbuild/issues/5383). The workaround is to add this file to blacklistRE in metro.config.js:

module.exports = {
  resolver: {
    blacklistRE: blacklist([
      /node_modules\/.*\/node_modules\/react-native\/.*/,
      /node_modules\/react-native-macos\/.*/,

      // Workaround for `EBUSY: resource busy or locked, open '~\msbuild.ProjectImports.zip'`
      // when building with `yarn windows --release`
      /.*\.ProjectImports\.zip/,
    ]),
  },
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
};

Invalid Podfile file: undefined method `[]' for nil:NilClass

This can occur if your package is iOS specific, i.e. it contains no ios folder with an Xcode project. react-native config cannot detect your package if this is missing. We can work around it by adding a dummy project to react-native.config.js at the root of the package:

module.exports = {
  project: {
    ios: {
      project: "ReactTestApp-Dummy.xcodeproj",
    },
  },
};

There is no memory profiling because "Address Sanitizer" is enabled

image

For security reasons, Address Sanitizer is enabled by default. You can disable it by editing the scheme as documented in Diagnosing Memory, Thread, and Crash Issues Early.

Your project does not reference "UAP,Version=v10.0" framework

This error may occur when with react-native-windows 0.68 and above. Add Directory.Build.props to the root of your repository with the following content:

<?xml version="1.0" encoding="utf-8"?>
<Project>
  <PropertyGroup Label="NuGet" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
    <ResolveNuGetPackages>false</ResolveNuGetPackages>
  </PropertyGroup>
</Project>