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

App crashes immediately after attempting to initialize TrackPlayer #2412

Open
Mirott opened this issue Nov 29, 2024 · 6 comments
Open

App crashes immediately after attempting to initialize TrackPlayer #2412

Mirott opened this issue Nov 29, 2024 · 6 comments
Labels

Comments

@Mirott
Copy link

Mirott commented Nov 29, 2024

Describe the Bug
The app disappears from the foreground immediately after attempting to execute the code TrackPlayer.registerPlaybackService or TrackPlayer.addEventListener
The console does not show anything.
The only thing that appears is a MacOS crash message with the error information:
Crashed:: com.facebook.react.runtime.JavaScript

Steps To Reproduce

  1. Install a new Expo project.
  2. Install react-native-track-player.
  3. Add the code to initialize TrackPlayer.
  4. Run the application on iOS

Code To Reproduce

import TrackPlayer from 'react-native-track-player';
import { Event } from "react-native-track-player"

const PlaybackService = async function () {
    TrackPlayer.addEventListener(Event.RemotePlay, () => TrackPlayer.play());
    TrackPlayer.addEventListener(Event.RemotePause, () => TrackPlayer.pause());
};
TrackPlayer.registerPlaybackService(() => PlaybackService);

Environment Info:

"react-native": "0.76.3",
"expo": "52.0.11",
"react-native-track-player": "4.1.1",
System:
  OS: macOS 15.0.1
  CPU: (8) arm64 Apple M3
  Memory: 94.98 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.3.0
    path: ~/.nvm/versions/node/v21.3.0/bin/node
  Yarn:
    version: 1.22.21
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v21.3.0/bin/npm
  Watchman:
    version: 2024.11.18.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK:
    API Levels:
      - "26"
      - "27"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.2
      - 34.0.0
      - 34.0.0
      - 35.0.0
    System Images:
      - android-33 | Google APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.21829.142.2421.12409432
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 19.0.2
    path: /usr/bin/javac
  Ruby:
    version: 3.3.6
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.3
    wanted: 0.76.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Real device? Or simulator?
Both
What OS are you running?
MacOS 15.0.1

@Mirott Mirott added the Bug label Nov 29, 2024
@Mirott Mirott changed the title The application crashes immediately after attempting to initialize TrackPlayer App crashes immediately after attempting to initialize TrackPlayer Nov 29, 2024
@TerryMooreII
Copy link

@Mirott Currently experiencing the exact same issue with the same setup. Have you had any luck resolving this?

@TerryMooreII
Copy link

@Mirott I was able to get this working with expo by using the 3.x release. fwiw i also had the issue with the nightly release.

npm install --save react-native-track-player@3

@rajibola
Copy link

  1. npm install --save react-native-track-player@3
  2. cd ios && pod update
  3. cd ..
  4. Rebuild the app again

@lovegaoshi
Copy link
Contributor

possibly one of many newarch incompatibility duplicates. see #2395 and #2389. please google to reduce SNR

@vl4di99
Copy link

vl4di99 commented Dec 10, 2024

I suppose it's because of the new architecture on Expo 52, too. The app crashes instantly, without even initializing. Hope it will get fixed asap. Will try version 3 for now...

@saraspaudel
Copy link

With version 3 it does not work for Android

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

No branches or pull requests

6 participants