matinzd/react-native-health-connect

Android app crashes when adding permissions for react-native-health-connect

vipul7387497208 opened this issue · 1 comments

Description

I have developed a React Native application that works fine in its basic form. To enhance its functionality, I decided to integrate the react-native-health-connect library to access health-related data. Following the library's official documentation, I was able to install and link the library to my project without any initial issues.

Issue

However, after adding the necessary permissions to the Android manifest and attempting to run the application on an Android device, the app crashes immediately upon launch. I attempted to run the same codebase on iOS and in a browser environment. As expected, it showed an error message stating that react-native-health-connect is not supported on these platforms, which aligns with the library's documentation. The primary concern is the unexpected crash on Android, which is supposed to be a supported platform.

Steps to Reproduce

  1. Create a new React Native application.
  2. Install the react-native-health-connect library using npm.
  3. Follow the installation and setup instructions provided in the library's README, including the addition of permissions in the Android manifest.
  4. Attempt to run the application on an Android device/emulator.

Error
lateinit property requestPerssion has been initiazed,

Expected Behavior

The application should launch without crashing, and the react-native-health-connect library should be initialized successfully, allowing for health data access following user permission.

Actual Behavior

The application crashes immediately upon launch on Android devices, with no specific error message provided that could hint at the cause of the issue.

Environment

  • React Native version: 0.73.6
  • React version: 18.2.0
  • react-native-health-connect version: "react-native-health-connect": "^2.0.1",
  • Android version:14

Additional Context

  • Include any additional information that might be relevant to diagnosing the problem, such as specific permissions added to the Android manifest.
  • If possible, include logs from Android Logcat that show errors or warnings at the time of the crash.

Screenshots
Screenshot from 2024-03-28 20-51-15

Duplicate of #71.