react-native-example icon indicating copy to clipboard operation
react-native-example copied to clipboard

Database operations are not working when i run in release mode :(

Open wliadmin opened this issue 6 years ago • 6 comments

Database operations are not working in release mode

Steps to reproduce

-> Run this demo by archiving application in iOS -> Database operations are not performing in release mode

Expected behaviour

-> All the database operations should be performed

wliadmin avatar Nov 22 '18 07:11 wliadmin

@wliadmin where you able to find a solution for this issue?

celodauane avatar Jan 17 '19 08:01 celodauane

I cannot get https://github.com/typeorm/react-native-example/ to run on either Android or iOS with or without metro-minify-terser

Try https://github.com/sheva007/typeorm-boilerplate/

This runs on iOS debug/release and Android in simulator in debug mode. On iOS I wen to select "Legacy Build" from Xcode > File > Project Settings

I cannot get an Android release build to run?

Perhaps an issue with signing setup?

react-native run-android --variant=release
info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installRelease)...

FAILURE: Build failed with an exception.

* What went wrong:
Task 'installRelease' not found in project ':app'. Some candidates are: 'uninstallRelease'.

A debug build runs fine on Android simulator:

react-native run-android

esutton avatar Apr 12 '19 17:04 esutton

This issue is due to minification in release mode changing class names and file names. It can be fixed with the following steps:

  1. yarn add metro-minify-terser
  2. Update the metro config to keep class names and file names. Add the following to the metro.config.js transformer:
minifierPath: 'metro-minify-terser',
minifierConfig: {
    ecma: 8,
    keep_classnames: true,
    keep_fnames: true,
    module: true,
    mangle: {
        module: true,
        keep_classnames: true,
        keep_fnames: true,
    },
 },

jbenzshawel avatar Oct 24 '19 17:10 jbenzshawel

This issue is due to minification in release mode changing class names and file names. It can be fixed with the following steps:

  1. yarn add metro-minify-terser
  2. Update the metro config to keep class names and file names. Add the following to the metro.config.js transformer:
minifierPath: 'metro-minify-terser',
minifierConfig: {
    ecma: 8,
    keep_classnames: true,
    keep_fnames: true,
    module: true,
    mangle: {
        module: true,
        keep_classnames: true,
        keep_fnames: true,
    },
 },

thank you! It's very useful to me

Ben002 avatar Oct 28 '19 13:10 Ben002

This issue is due to minification in release mode changing class names and file names. It can be fixed with the following steps:

  1. yarn add metro-minify-terser
  2. Update the metro config to keep class names and file names. Add the following to the metro.config.js transformer:
minifierPath: 'metro-minify-terser',
minifierConfig: {
    ecma: 8,
    keep_classnames: true,
    keep_fnames: true,
    module: true,
    mangle: {
        module: true,
        keep_classnames: true,
        keep_fnames: true,
    },
 },

I tried this solution but the problem has not been solved yet can you help me pls?

MahsaKarimi72 avatar Apr 28 '20 10:04 MahsaKarimi72

Changing the minifier config didn't work for me (react native version 0.67). However, I was able to get it working in release builds by explicitly setting table names in the entity decorator:

@Entity({ name: "my_table_name" })
class MyTableName {

...

kevinmanncito avatar Jun 10 '22 20:06 kevinmanncito