React Native Android APK building - images in the app are not loading - react-native

When I run the app using react-native run-android app is loading fine with all images (not talking about external urls, images in the app folder). but when I generate the apk using ./gradlew assembleRelease, the apk is generating fine but with no images. I didnt see any errors when generating the apk
I deleted the .dist folder in node_modules and have tried running the command curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
from this link Android failed to load JS bundle
I want the apk generated should have the images

Please try with https instead of http

Related

Eas build showing notvalid png

√ Linked local project to EAS project 1bff4275-86f9-4b0d-bb2f-.....
PNG images validation failed:
"exp.icon" is not valid PNG
When I run following command
eas build -p android --profile preview
When I tried it first it was running but now I am getting this error

How to reduce the android app bundle size in EAS EXPO?

I created an empty project and uploaded it using EAS build for android. "eas build -p android". but the app.aab file has 30.9MB. An empty native project in kotlin/java has something about 5-7MB. How can I reduce this EAS app bundle?
expo build:android -t app-bundle works for me

eas build --platform android VS expo build:android -t apk

I am generating APK using eas build --platform android and expo build:android -t apk.
Both generate apps but the eas build generated app crashes while the expo build app works fine. There is no difference in code. Not able to check why it happens. Any suggestion would be helpful.
I resolved the issue by manually installing some dependency that EXPO is managing itself.
Building .apks using EXPO command expo build:android -t apk never crashed on the physical device, but when I switched to EAS command eas build --platform android the app crashed on physical devices.
Dependency e.g "react-native-screens": "~3.8.0". Now i can export .apk and .aab using EAS command eas build --platform android
Other issues like camera and gallery permission are also managed by EXPO if you don't mention them.
This may be because of the Expo SDK version.

React Native could not connect to development server error while running apk installed app on android

I have build the apk of my react native app and installed it on android device. But whenever I try to open the app it shows below errors:
ss1
ss2
Any help or suggestion would be well appreciated.
you can use ./gradlew assembleRelease to generate apk in release mode or ./gradlew bundleRelease to generate the bundle of the app .aab
for more, you can follow this https://reactnative.dev/docs/signed-apk-android#generating-the-release-aab

Sourcemaps not working for React Native Android app in production

I using Sentry to log crashes in my app in production. The sourcemaps are working as expected for iOS app but for Android, I don't the actual file and line number at which the crash happened. The stack trace contains references to index.android.bundle. I use the following command to create the bundle and the map file
react-native bundle --dev false --platform android --entry-file index.android.js --bundle-output index.android.bundle --sourcemap-output index.android.map
I upload the bundle and map files to sentry using command
sentry-cli releases files 1.0.10 upload-sourcemaps --rewrite --url-prefix / ./
I wanted to ask whether anyone has been able to get the sourcemaps to work for Android using Sentry. Are there any other instructions that I need to follow to get the sourcemaps to work for Android app?
It should work if you just call ./gradlew assembleRelease if you are running the latest version of react-native-sentry.
As described here:
https://docs.sentry.io/clients/react-native/#android-specifics