Music is not playing on release apk .using library react-native-track player - react-native

React naive app Music is not playing on release apk .using library react-native-track player.
It works fine with local host both in emulator and real device while debug mode.
Is der any specified place to keep mp3 files ?
I'm trying to load from bundle only
I'm a windows machine user
Please refer this git below you may clone it as well..
https://deva11#bitbucket.org/deva11/trackplayertest.git
Debug Mode :
Release Mode
in reference to react-native-sound .I am aware that music files should keep in android/app/src/main/res/raw folder and while bundling assets in react-native folders will be merging with android native folders.
How can I match it up ?

This issue has been fixed in 6c57395.
In release mode, React Native used to copy all resources into the drawable directory, and react-native-track-player used to look up the files there.
After an update, React Native started copying non-image files to the raw directory, and that broke the feature.
In case someone is looking for an answer, the proper way to load files from the device, is to prepend the path with file:///, here's an example:
TrackPlayer.add({
url: 'file:///storage/sdcard0/Music/song.mp3',
// ...
});
And the proper way to load files inside the app bundle is to require/import them:
TrackPlayer.add({
url: require('./song.mp3'),
// ...
});
If that doesn't work, feel free to open an issue in the react-native-track-player repository

Related

.env variables working on expo published app but not from google play build

My app is working properly locally and also from the QR code on the Expo published app page.
On my production build on Google Play though, the .env files are undefined and not loading at all (I am using dotenv-react-native).
This may be due to the fact that my .env file was in .gitignore while I was building my first android build? I updated it with an OTA update after by creating a .easignore file and excluding the .env file. Does it not work with OTA updates? Do I need to rebuild the application or is it some other issue?

How to fix optimazition error publish in play store

my apk is 1.4MB but error is "This APK results in unused code and resources being sent to users. Your app could be smaller if you used the Android App Bundle. By not optimizing your app for device configurations, your app is larger to download and install on users' devices than it needs to be. Larger apps see lower install success rates and take up storage on users' devices."
how to fix this error
It's only a warning, not an error.
For an app that small I wouldn't worry.
It's not something that's made its way into the Ionic ecosystem yet but I heard that if you open up your project in Android Studio and then do the build through there you can create an app bundle.
I'm not totally sure that its fully tested for Ionic so you might have issues with this, but Android have published a full guide:
https://developer.android.com/guide/app-bundle#get_started
This is what they say:
Download Android Studio 3.2 or higher—it's the easiest way
to add dynamic feature modules and build app bundles.
Add support for Dynamic Delivery
by including a base module, organizing code and resources for configuration
APKs, and, optionally, adding dynamic feature modules.
Build an Android App Bundle using Android Studio.
If you're not using the IDE, you can instead build an app bundle from the
command line.
Test your Android App Bundle by using it to generate APKs that
you deploy to a device.
Enroll into app signing by Google Play.
Otherwise, you can't upload your app bundle to the Play Console.
Publish your app bundle to Google Play.

How can I bundle .proto files with a React Native app?

I am trying to build an app to communicate with embedded devices using Protocol Buffers with protobuf.js
I want to load the content of .proto files at runtime. The files are pulled from a shared repo and I want to have them bundled with the app at build time.
I know I can read files with RNFS from DocumentDirectoryPath, but how do I tell React Native to put them there when building the app? Or is there a better way to do this?
probably a duplicate of In React Native how do you bundle a text file and read it's value at runtime?.
if you put anything inside android/app/src/main/assets folder it will be in your final .apk file, and you can read it with
RNFS.readFileAssets
Also there are more customized libraries like This one

React native init project is very large in size

Here is the versions I am using
The problem is the project I created using react-native init AddisMereja is of size 20MB.
It does not have anything.
I believe you are talking about the size of the apk file that is generated. If so you can try using app bundle and submit the app bundle to google play store which will handle it according to users device as the apk that is generated by default contains apps for different architectures but you will end up using only one of them.
This blog post by Krzysztof Magiera explains the process better.
Your app size is descries after make a release apk Or sign apk.

Why is IOS folder too huge when compared to android folder in React-Native?

I have developed an app in react native, but the project folder is too large(1.2GB) to upload into git and the IOS folder itself holding 0.9GB.I have done the following steps to overcome the issue
Steps Followed :-
Deleted Android and IOS folders from project folder.
Uploaded and Downloaded the project code using git.
Later run the commands like npm install and react-native upgrade
After running the above commands to generate IOS and Android folders, we are supposed to run Android version, but facing issue with IOS.
So...I request you to let me know the proper process of uploading code into git such that i can run both Android and IOS.
Make sure you have a .gitignore and make sure at a minimum that the build and node_modules folders are not included. For me 95% of the size is from that.
example gitignore