React Native Android staging build crashes on startup - react-native

I have added 2 more buildTypes in my build.gradle file staging & prestaging alongside with release. When I build and run the release buildType it works fine on the real device, but when I build and run staging or prestaging builds both crashes on startup. The crash report on the device shows the following error:
All the builds work without any issue on iOS

My staging and prestaging build failed because the bundle were not packaged correctly as the error says. This is because when building Android app react-native only add the bundle to the package if the buildType name contains the word release. The simple solution for this is to name the buildType's in such a way that the names contain the word release. I renamed the buildType's to stagingRelease and prestagingRelease.

Related

Not going to release apk after expo eject

I created a new project at Expo, after which I was already building it using expo buildbut over time I needed to move away from Expo a little and execute an expo eject, and then continue development on regular React Native.
I ran into the following situation: I am trying to build an apk file with the ./gradlew assembleRelease command, but I get a debug build instead of release, I don’t understand why this is happening, I tried to follow the build instructions specifically for the release version - unsuccessfully.
I also tried to create a new project without using Expo - the whole scenario described above worked correctly and I got a release build of my application, and with all that, I compared the android/app/build.gradle files in these two projects and they are almost identical in terms of their configuration.
My main task and problem is to build the release version of the apk file and understand why, with different attempts to build, I only get the debug apk.

build archive fails but build from react-native run-ios works

my react-native project builds and run from npx react-native run-ios and also it runs from xcode. now i am almost done with what i want to do and wanted to publish a version for test flight on app store but i cant archive the product which is how i used to do before. it fails right away with some swift error. in this work i added a dummy swift file and xcode also added bridge file as part of it. here is the error i get:
Been there,
make sure all the three pod, project and target have the same IOS Deployment Target.

Build Apk file is not working same as debug APK file work in react-native

I have an existing project. I build an APK file a month ago for the first time. it was working the same as debugging APK file work in the emulator. But I have added some new features to my project and it works properly in the emulator. But when I build an APK it is not updating anything(any features). it looks like the same as before(previous build/version). Every feature appears and works properly in the emulator but after building APK file, not a single new feature is working on the mobile.

React Native: Android Studio doesn't automatically bundle when building

I am building a react native application and we're doing the production release.
I noticed that everything works in my iOS app (there's a build phase that generates the offline bundle) but when I run the release build in Android Studio, my app builds but it crashes because it can't find the bundle.
I was able to resolve my own question:
We changed our build types/flavors to match our desired configuration.
The react.gradle file that comes with React Native has a configuration for Debug and Release, these are the common build tasks in a native application. BUT once you change things up you need to tell the react library in android whether or not you want it to bundle for you.
You can find this in your app's build.gradle (under
./android/app/build.gradle). There's an entire block of guidelines commented out that explain you what to do.
In my case I had to add the following code before apply from: "../../node_modules/react-native/react.gradle"
ext.react = [
bundleInNameDebug: false,
bundleInNameBeta: true,
bundleInNameRelease: true
]
NameDebug, NameBeta, NameRelease are all custom BuildTypes/BuildFlavors I have configured.
If you have the signing configuration, it should build a apk for testing when you run react-native run-android --variant=release with the offline bundle. If you want to make a release build for Playstore, run ./gradlew assembleRelease inside the android folder.
You can find more info here

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).