react-native-track-player: Unable to reproduce audio after build/release(android) due invalid source

Describe the Bug Hey guys, I am using the last RC(4.0.0-rc07) and I facing a problem when building in release mode in Android, in debug works fine, but soon after building using the release mode, the player is unable to resolve the path of the audios files, no matter if we use import or required, always resolve by joining the path to the assets without extension.

Steps To Reproduce How can someone else reproduce this bug? Build the apk in mode release and try to run the app on a real Android device, you will get the error message source error when hit the play button

Code To Reproduce Please provide a simple code example that allows others to replicate the bug. Just follow the react-native-track-player/tree/main/example in release mode

Replicable on Example App? Can you replicate this bug in the React Native Track Player Example App? Yes When I tried to create a release of the example, I got this error > Task :app:createBundleReleaseJsAndAssets FAILED

Environment Info: Paste the results of npx react-native info npx react-native info info Fetching system and libraries information… System: OS: macOS 13.1 CPU: (8) arm64 Apple M1 Memory: 58.89 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.10.0 - ~/.nvm/versions/node/v18.10.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v18.10.0/bin/yarn npm: 8.19.2 - ~/.nvm/versions/node/v18.10.0/bin/npm Watchman: 2023.06.12.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.12.1 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: API Levels: 28, 29, 30, 31, 32, 33 Build Tools: 29.0.2, 30.0.3, 31.0.0, 33.0.0 System Images: android-31 | Google APIs ARM 64 v8a, android-31 | Google Play ARM 64 v8a, android-33 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9014738 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.16.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.12 => 0.69.12 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found Paste the exact react-native-track-player version you are using react-native-track-player : ^4.0.0-rc07 Real device? Or simulator? Real device(Samsung S22 Ultra) What OS are you running? Android

How I can Help What can you do to help resolve this? Have you investigated the underlying JS or Swift/Android code causing this bug? Can you create a Pull Request with a fix?

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 4
  • Comments: 26 (3 by maintainers)

Most upvoted comments

@akshaymanagooli I applied the changes from the pull request: https://github.com/doublesymmetry/react-native-track-player/pull/2194

Basically very minor edit, you only need to change line no 38 of trackPlayer.ts as seen here: https://github.com/doublesymmetry/react-native-track-player/pull/2194/files

I happen to have.a release build of the example app and can confirm it happens in the example app with rc07 Screenshot_20230825_081118_RNTP Example

And fyi with other local paths with rn fetch blob you can just put file:///… As your uri

@lovegaoshi that’s strange, but:

  • require() in both modes returns a valid number
  • when I trying to call player.load(track) - everything worked correctly (thanks for that)
  • but if I’m trying to call player.add(track); player.play() - android debug mode works ok, but in release mode background audio widget is starting, loading for a while and then just closes.

Hey guys I would like to add that the Rc 4.0.0-rc05 works fine in release mode.