React-native-track-player: Cannot read propery 'STATE_NONE' of undefined

Created on 15 Apr 2018  路  5Comments  路  Source: react-native-kit/react-native-track-player

import TrackPlayer from 'react-native-track-player';
could not importing TrackPlayer

Most helpful comment

To solve this I had to do this https://github.com/react-native-kit/react-native-track-player/wiki/Installation#ios-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64

Then I restarted the bundler and everything was ok. We could do something like this in lib/index.js on lines 12-14 to catch something like this and provide at least a helpful message:

if (!TrackPlayer) {
  console.error("FATAL: FAILED TO LOAD TrackPlayer from NativeModules, did you enable swift in this project? https://github.com/react-native-kit/react-native-track-player/wiki/Installation#ios-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64");
}

All 5 comments

To solve this I had to do this https://github.com/react-native-kit/react-native-track-player/wiki/Installation#ios-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64

Then I restarted the bundler and everything was ok. We could do something like this in lib/index.js on lines 12-14 to catch something like this and provide at least a helpful message:

if (!TrackPlayer) {
  console.error("FATAL: FAILED TO LOAD TrackPlayer from NativeModules, did you enable swift in this project? https://github.com/react-native-kit/react-native-track-player/wiki/Installation#ios-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64");
}

I had this error on iOS. As @jimthedev mentioned, I went ahead and created the dummy.swift file within Xcode and that fixed it. https://github.com/react-native-kit/react-native-track-player/wiki/Installation#ios-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64

I had the same issue earlier today.

I looked at the console output after running react-native run-ios and found some errors, including PCH was compiled with module cache path.... I fixed it by going XCode - Product - Clean and then
running rm -r ios/build.

https://stackoverflow.com/questions/15463179/how-to-fix-pch-error

What if you have the same issue on Android ?

Ok I was missing the Google play services. Now it is working

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ManrickCapotolan picture ManrickCapotolan  路  4Comments

moduval picture moduval  路  4Comments

JakeMotta picture JakeMotta  路  3Comments

b3rkaydem1r picture b3rkaydem1r  路  3Comments

mckmarc picture mckmarc  路  4Comments