Is it possible to compile a react-native app for android with an offline pc - react-native

Upon trying my first react-native android app with a win 10 pc, after entering the command react-native run-android, the compiler downloads a lot of files gradle-**-all and some *.pom files before finally deploying the app. i'm in a country with expensive data bundles so i want to ask:
Does this happen for every project, or every compile ?
If yes, are there workarounds ?
Because i need to be able to develop apps while offline.

Related

Where can I source help for native crashes of an expo EAS apk build

I am building an app using react-native on Expo and making sure to build with EAS every few days or whenever I add a new dependency.
After every build, I install the apk on an Android device and run the ios build on a simulator.
On my latest build, the build completes successfully but after installing the apk on android 10, the app opens and crashes once I navigate to a certain page.
It works fine on 3 other android phones.
The code difference between the last successful build that doesn't crash to the current one is minimal however very necessary for the app.
How can I see logs from the native crash in order to find the cause of the problem and hopefully find a fix?
I tried to install sentry but at the bottom of the page, it explains it only follows js issues and is not native.
Any ideas will be helpful
Thanks

react native expo building javascript bundle multiple times and fail

I'm currently developing react native app and kinda new to it. Sometimes when I open my app in expo(usually using my iPhone device to debug app) it building javascript bundle multiple times very rapidly and it's unavailable to open app in my phone while the expo bundler is keep building javascript.
Indeed I need to force server to stop and restart, sometimes it works but not always.
It's not a big issue since I restart the app It's okay but why is this happening?
this is my screenshot of building javascript in expo. green one is from terminal and white one is from expo...

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.

React Native application deployment

I have already developed a React native application on my mac book, this is myfirst application. I want to deploy it to iPhone so that I can test it. I don't want to put it on appstore yet. I am not sure how to compile the application and get it ready to put it on iPhone. I tried this web site
https://www.diawi.com/, but not sure which .ipa or a.pk file, I need to upload. I can also try using expo, but not sure how to use it. Can anyone give me step by step instruction on how to upload this application on iPhone.
any help will be greatly appreciated.
For iPhone
For react-native-init you will probably need Apple developer account to test your app on your phone
Since you are using react-native-init, You should checkout this article by Facebook
https://facebook.github.io/react-native/docs/running-on-device
In the second point, it says Register for an Apple developer account if you don't have one yet
For create-react-native-app you need to do following
Download expo client from App store
Scan the QR code expo generate when you run your app using terminal (npm run start in terminal )
Note: Both Laptop and your phone should be on the same network
According to this thread, You can't use expo with react-native-init but alternatively you can create an expo project using create-react-native-app and then copy, paste files from your init project
For Android
For running your App on Android, You can directly generate/build an apk, send it to your device and just open it to see how it works (In Android you don't need a console or developer account to run your app)
Again, Open this link https://facebook.github.io/react-native/docs/running-on-device
And click on Android Tab to see how you can generate an Apk

Tips/help to debug no apk file

My environment :
Eclipse sdk 3.7.2
Worklight pluin 5.0.5
Android sdk 2.2
First I tried a simple Hello World, everything works fine, android native project was created and I see the corresponding apk file was generated after a build and deploy.
Next I imported a sample project, successfully got it run on the test (localhost) server, able to see the expected result on the android Mobile Browser Simulator but the problem now is I am not seeing the corresponding android apk file got generated (the android native project was created). No errors on the logs, Any idea what could be the problem? How one debug such a problem.
APK will be generated under \bin\ folder once you run your app for the first time.
Connect your Android device to dev machine via USB cable (assuming you got Android SDK etc installed), right click on Android project and do Run as->Android app.
The app will be installed and started on Android device. APK will be generated in \bin folder.
In general, you don't need the device, same thing can be done with emulator.
You can also do an export on the android application project. This is what you would do if you are looking at doing some key signing. This is the way you would want to export it if you are uploading to Google play or an enterprise app store.
Keep in mind, Worklight doesn't build your .ipa, .apk, or etc. It builds you compile ready resources. It will build you the folder structure and the project layers needed to build in the corresponding Native Environment (for apple, you would export to xcode, build it, and run).