React native init project is very large in size - react-native

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.

Related

react-native Is there any api can recognize my release is aab format or apk format?

I am building an react-native app.
I know there is api such as Platform.OS can recognize the the platform is android or ios.
Is there any api can recognize my release is aab format or apk format?
We likely need more information in order to answer your question accurately.
I'd guess this is not possible since the .aab or .apk is the bundled code. React Native runs on the JS Core engine. I'm struggling to see why you would want to know this though within your application as you should be using the Android App Bundle OR submitting with the APK, not a mix of both.
Indeed in Google Play once you've enabled Managed Signing (to use the .aab) then I don't think you can go back to using the .apk files.

Use expo partially with RN with custom native-modules

I'd like to try expo for faster development.
It's said that you can't use native-module if you use expo.
But it seems it's possible to use native-module if you eject or use bare mode. (not sure if they are the same)
Or it seems it's even possible to start from RN-cli and add expo features.
Are they all the same in what we can do in the end?
How about apk size? Is there a way to cut down the 20-25M file size by starting from RN-cli and adding Expo on top of it or by ejecting ?
I don't think you can do that and achieve 25M File size.
But, I will give you a good solution if you want expo functionality as well as the Native capabilities.
You can try the bare minimum setup with expo.
What it will do is, It will create a react-native init project with unimodules.
Unimodules will have access to some basic expo features, for example permissions etc etc.
And in future if you want to add some other expo feature (which supports bare apps).
You can add them pretty easily.
In expo docs, you can check which features are available in bare apps and which are not.
The main concern for me is that bare apps don't support the background tasks of expo yet.
I always start my apps with this. But the downside would be that the app would be around 30-35mb,
You can still try to minimize it
https://medium.com/#aswinmohanme/how-i-reduced-the-size-of-my-react-native-app-by-86-27be72bba640
Expo has group of packages provided by expo.io. The app built with expo has bigger apk size because we are also bundling the packages which we are not even using. these are the packages comes with expo
https://github.com/expo/expo/tree/master/packages
Best solution to reduce apk size is start with building app without expo then add only required dependencies. If your project needs expo features you can use Expo kit
https://docs.expo.io/versions/latest/expokit/expokit/
Thank you

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.

Building React Native App for Release to Store

I am building out a CI build script to prepare a React Native application for the App/Play store. Looking at [the official docs][1], there are several manual steps involved that must be done each time. Obviously, I'm shooting for a hands-off build process.
Is there an automatic way of generating a signed and ready for upload iOS/Android build that I'm missing?
For Android - https://facebook.github.io/react-native/docs/signed-apk-android.html - that works all from CI.
For iOS I'm not sure, I always need to use XCode - https://www.raywenderlich.com/127939/submit-an-app-part-2 - I do hear though that Expo gives you a IPA file and that can be uploaded, but never sure.

Upload a prebuilt file to Crashlytics

I am trying to automate our build/release process. I am specifically concerned with the Android app at the moment, but I may also need to extend similar support for our iOs app.
Until now, all uploads to Crashlytics have been triggered with crashlyticsUploadDistributionRelease. However we are now building and testing the apk first, then looking to upload that same pre-built apk to Crashlytics. The new process means we need a way of uploading the apk to Crashlytics directly, without having any dependencies on rebuilding or being within the project's directory.
I can see that I can do this through Android Studio by dragging and dropping the apk. Is there a command line tool or script that I can use to automate something similar from our build machine?
This operation is not currently supported. See my comment above for the response from the Crashlytics team