Open KalobTaulien opened 2 months ago
Well.. interesting.. After fighting with this for 24 hours, I did various things. I'll list out what I did to get this to work on Android (Note: I don't know which one of these things actually worked but here's what I tried, in this order).
First attempt:
rm -rf node_modules && npm cache clean --force && npm install && watchman watch-del-all && rm -rf $TMPDIR/haste-map-* && rm -rf $TMPDIR/metro-cache && npx expo start --clear
Second attempt:
rm -rf node_modules/ android/ ios/ .expo/
npm i
npx expo prebuild
npx expo start
Third attempt:
Build a development build with expo and then select y
to download and install it on your computer.
eas build --profile development --platform android
This didn't work, so I needed to run adb uninstall "com.mycustom.appname"
(or whatever your app.json's expo.android.package
value is) and then try again.
I also tried npx expo install expo-av
and that also failed for a different reason.
Fourth attempt:
Run npx expo start
and select Android. Then switch to Expo Go
(it's the s
key on the command line). That failed, and it failed hard. So then I switched back to a development build. Which brought me back to the original issue.
🎉 Fifth attempt (this worked for me): 🎉 Using Expo, use the development build. But download it from Expo manually, and install it manually. Here's the solution that worked for me (so far, I'm not convinced this will be the solution forever after struggling with this so hard)
eas build --profile development --platform android
and wait for it to build. Do not automatically install. Then go to https://expo.dev/ and manually download the latest android development build to your computer.adb uninstall "com.mycustom.appname"
followed by adb install ~/Downloads/application-ed9923123-blah-blah.apk
(You will need to adjust the paths as needed for your computer). If successful, move onto Step 3. npx expo start
(use development build, not Expo Go). Select Android and try it out. It worked for me. I am not certain why this worked when other development builds failed, but this did the trick for me.
Comment out all TrackPlayer imports
To make life easier, comment out all import TrackPlayer from 'react-native-track-player';
lines, except for ONE instance (ie the App.js file). This way you can kind of isolate the problem to this one issue.
Install expo-av
I'm not sure if this is making a difference or not, but I have expo-av installed. npx expo install expo-av
(note: its NOT using npm install
for a reason)
Add space via Android Studio I couldn't install Expo Go at one point because of:
expo go android install failed INSTALL_FAILED_INSUFFICIENT_STORAGE
Open Android Studio -> Virtual Device Manager -> Edit your testing device (click the pencil icon) -> Show Advanced Settings -> Add Internal Storage (I went from 6gb to 12gb)
Update all the android Studio things Sometimes ya just need to give up and update everything. Open Android Studio -> SDK Manager -> Languages & Frameworks -> Android SDK (update all existing installs in "SDK Platforms" and "SDK Tools"; no need to download anything extra)
Package versions I'm using Here is my slimmed down package.json file with the relevant versions that seem to work so far.
{
"name": "app-name-here",
"version": "1.0.0",
"scripts": {
...
},
"dependencies": {
"expo": "~50.0.20",
"expo-av": "~13.10.6",
"expo-dev-client": "~3.3.12",
"react": "18.2.0",
"react-native": "0.73.6",
"react-native-track-player": "^4.1.1",
},
"private": true
}
Should anything else come up, I will continue to add to this comment.
If this helped, leave an emoji reaction to help other fellow developers use this awesome package! 🎉
expo managed is inherently not dev friendly to any RN libraries that modifies native code. and I dont recommend anyone seriously looking into app development to completely avoid native code and use expo managed. RNTP has heavily edited native code and will most likely not work with expo managed at all.
RNTP's expo compatibility comes with expo's inherent compatibility with ANY RN project. you should follow https://docs.expo.dev/bare/installing-expo-modules/ instead. my app uses expo in the exact same manner. https://github.com/lovegaoshi/azusa-player-mobile/blob/3b921a4b177664c886779675cfe2933de5fe9a3a/package.json#L59
I too am experiencing this, but I'm not using expo--using a proprietary react-native framework, so unable to provide a repro. Is there a clue to what this error actually means? Personally, I traced it to the use of the NativeModules
import from react-native, which doesn't exist in the latest versions of react-native https://github.com/doublesymmetry/react-native-track-player/blob/main/src/TrackPlayerModule.ts#L2. My version of react-native is effectively next, so it makes sense to me that TrackPlayerModule
does not exist on the NativeModules
object. Perhaps this getting fixed will resolve it for me? https://github.com/doublesymmetry/react-native-track-player/issues/2293
I started using this package last night and LOVE it! It works flawlessly on iOS. Unfortunately it doesn't seem to do what it's supposed to in the Android Emulator.
Describe the Bug Having
import TrackPlayer from 'react-native-track-player';
anywhere in a React Native / Expo project causes the error. The error from the terminal is this:Steps To Reproduce
npm install react-native-sound --save
import TrackPlayer from 'react-native-track-player';
anywhere into your codebasenpx expo start
and select AndroidCode To Reproduce N/A
Environment Info: Paste the results of
npx react-native info
:Paste the exact
react-native-track-player
version you are using:"react-native-track-player": "^4.1.0",
Real device? Or simulator? Android Emulator