Skip to content

Android : Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCGeolocation' could not be found. #345

@pankaj-bhardwaj

Description

@pankaj-bhardwaj

Environment

"react": "18.3.1",
"react-native": "0.76.4",
"@react-native-community/geolocation": "^3.4.0",

Platforms

Android

Versions

  • Android: 31
  • react-native-geolocation: "^3.4.0",
  • react-native: "0.76.4",
  • react: "18.3.1",

Description

Created new react native project using cli comand and run it on the android emulator and ios simulator. After install the this npm and do the code as below

import GeoLocation from '@react-native-community/geolocation';

GeoLocation.setRNConfiguration({
skipPermissionRequests: false,
authorizationLevel: 'always',
enableBackgroundLocationUpdates: true,
locationProvider: 'auto',
});

GeoLocation.requestAuthorization();

Using ths above code snippet on iOS it is working as expected but android app is crashing, as below

Screenshot 2024-12-08 at 4 31 57 PM Screenshot 2024-12-08 at 4 38 44 PM

Reproducible Demo

  • Create new react native application - npx @react-native-community/cli@latest init AwesomeProject
  • Install this npm - yarn add @react-native-community/geolocation (also tried with recommended npm command)
  • Added above code snippet
  • Run the app on the android simulator

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions