Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why doesnt my @react-native-community\cli-platform-android package contain a native_modules.gradle file #2593

Closed
haydenrust1 opened this issue Feb 10, 2025 · 5 comments
Labels
question Further information is requested

Comments

@haydenrust1
Copy link

Ask your Question

Hello!
I have tried installing the @react-native-community\cli and the @react-native-community\cli-platform-android separately for testing this problem, and neither packages contain a native_modules.gradle file within the root directory of cli-platform-android. Am I doing something wrong? Why isnt it there? I need it for my android build! Thank you

@haydenrust1 haydenrust1 added the question Further information is requested label Feb 10, 2025
@atif089
Copy link

atif089 commented Feb 25, 2025

Are you using Node v20? Upgrading to v22 and nuking node_modules and android directory followed by a npm i fixed this for me.

@lulu-dev11
Copy link

Manually creating it in node_modules/@react-native-community/cli-platform-android works

import org.gradle.initialization.DefaultSettings

ext.applyNativeModulesSettingsGradle = { DefaultSettings defaultSettings ->
  logger.warn("\nDEPRECATION WARNING: The 'applyNativeModulesSettingsGradle' function is deprecated. Autolinking logic has moved to React Native Gradle Plugin. Please follow the upgrade instructions at: https://react-native-community.github.io/upgrade-helper/.\n")
}

ext.applyNativeModulesAppBuildGradle = { Project project ->
  logger.warn("\nDEPRECATION WARNING: The 'applyNativeModulesAppBuildGradle' function is deprecated. Autolinking logic has moved to React Native Gradle Plugin. Please follow the upgrade instructions at: https://react-native-community.github.io/upgrade-helper/.\n")
}

@Embraser01
Copy link

After looking a bit, in #2547, the native_modules.gradle was removed from the file property in package.json which means it's not included in the npm build anymore.

Same applies for ios native module file changed in the PR

@kyma
Copy link

kyma commented Mar 10, 2025

what should we do to fix this error then? the file no longer exists

@thymikee
Copy link
Member

The native logic for autolinking moved to the core react native in 0.75. Check the upgrade helper: https://react-native-community.github.io/upgrade-helper/?from=0.74.0&to=0.75.1 and follow the changes please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants