react-native-track-player: Error running basic expo

Describe the Bug When starting a basic expo app

TypeError: null is not an object (evaluating 'TrackPlayer.RATING_HEART')

Steps To Reproduce

start expo on android

Code To Reproduce Please provide a simple code example that allows others to replicate the bug.

import TrackPlayer from 'react-native-track-player';

const start = async () => {
  // Set up the player
  await TrackPlayer.setupPlayer();

  // Add a track to the queue
  await TrackPlayer.add({
    id: 'trackId',
    url: 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3',
    title: 'Track Title',
    artist: 'Track Artist',
    artwork: '',
  });

  // Start playing it
  await TrackPlayer.play();
};
start();

Environment Info: Paste the results of npx react-native info

❯ npx react-native info
warn Package expo-modules-core has been ignored because it contains invalid configuration. Reason: "dependency.platforms.ios" must be of type object
info Fetching system and libraries information...
System:
    OS: Linux 5.15 undefined
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900H @ 2.50GHz
    Memory: 1.46 GB / 15.31 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.14.0 - /usr/local/bin/node
    Yarn: 1.22.18 - /usr/bin/yarn
    npm: 8.3.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/bin/watchman
  SDKs:
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: 17.0.3 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: * => 17.0.2 
    react-native: * => 0.67.3 
  npmGlobalPackages:
    *react-native*: Not Found

Paste the exact react-native-track-player version you are using

"react-native-track-player": "^2.1.2",

Real device? Or simulator? Real device What OS are you running? Android

"expo": "^44.0.6",

How I can Help I looked up and found this issue

But the answer does not help in this case because im just importing the player.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 17 (1 by maintainers)

Most upvoted comments

Any solution ? I’m working with expo dev-cient and I can’t use react-native track player

@adelin-b @Taha-khojasteh ,

Please see if this is still an issue in v2.2.0-rc3 as it’s a complete android rewrite. If its still an issue there can you let us know?

Thanks!

@jspizziri

Unfortunately I still get same Error (with v2.2.0-rc3 version)

@jspizziri I’m willing to solve this issue, if there is any information, Let me know.

Getting same error with expo sdk 44 on android with v2.2.0-rc3 version

I’m going to close this until someone from the community is willing to contribute code for Expo.

@Taha-khojasteh that would be great! I don’t know anything about the issue other that what has been discussed on this issue so far.

I have the exact same problem, without using Expo… Is there a solution for this?