简体   繁体   English

在android的react-native release build中禁用minification和uglify

[英]Disable minification and uglify in react-native release build for android

I have properly working in development environment react-native application. 我已经在开发环境react-native应用程序中正常工作。 I wanted to test it's performance and released a build, which crashes after the launch. 我想测试它的性能并发布了一个在发布后崩溃的版本。

01-09 20:16:13.644 23215 23251 E ReactNativeJS: Object type 't' not found in schema.

01-09 20:16:13.648 23215 23251 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)

I couldn't determine the cause of crashing because of minification and uglify of the sources. 由于消息来源的缩小和丑化,我无法确定崩溃的原因。 Could you, please, help me with disabling it, because I already spent plenty of hours on it. 请你帮我禁用它,因为我已经花了很多时间。

react-native version: 0.49.5 react-native版本:0.49.5

You can accomplish this with the use of the CLI tool, Haul 您可以使用CLI工具Haul来完成此任务

Haul bundle --minify false should do the trick, if not, Haul provides other commands as well. Haul bundle --minify false应该可以做到这一点,如果没有, Haul也会提供其他命令。

putting --minify=false in extraPackagerArgs in android/app/build.gradle should do the job. 在android / app / build.gradle中的extraPackagerArgs中放置--minify = false应该可以完成这项工作。

project.ext.react = [
    entryFile: "index.js",
    extraPackagerArgs: [ '--minify=false' ],
];

I think you should first test your app by unchecking dev mode on your in app developer menu. 我认为您应首先在应用内开发人员菜单中取消选中开发模式来测试您的应用。

i had the same problem and it took me some time to figure out. 我有同样的问题,花了一些时间才弄明白。

i disabled the dev mode so it generates the JS bundle same like release bundle and i found the problem and fixed it. 我禁用了开发模式,因此它生成了与发布包相同的JS包,我发现了问题并修复了它。

If anyone got to here this might help: 如果有人到这里这可能会有所帮助:

node_modules/.bin/haul bundle --dev=false --config=node_modules/react-native-bundle-visualizer/src/webpack.haul.js

you can know more doing: 你可以知道更多:

node_modules/.bin/haul bundle --help

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果debuggable = false,为什么反应本地android版本会崩溃? - Why react-native android release build crash if the debuggable=false? 在 react-native Android 发布版本上查看控制台日志 - Viewing console logs on react-native Android release build react-native .58.1 无法构建 Android 版本 - react-native .58.1 cannot build Android release react-native版本发布APK失败 - react-native build release APK failed 管理React-Native Android的体系结构版本 - Managing architecture release for react-native android 如何将调试器附加到 react-native Android 应用程序中发布版本的本机代码? - How do I attach a debugger to native code of a release build in a react-native Android app? React-native Android 发布版本已损坏(UI 导航中断且无错误)- 在调试版本中正常工作 - React-native Android release build broken (UI navigation breaks without error) - works correctly in debug build Android 应用程序在发布版本时崩溃,但在调试版本中有效 - React-Native - Android app crashes on release build but works in debug build - React-Native React-Native 在 Android 上禁用图像缓存 - React-Native Disable Image Cache on Android 在纱线工作区 monorepo 中使用 react-native (0.68.2) 的 Android 版本构建崩溃 - Android release build crashes using react-native (0.68.2) in yarn workspaces monorepo
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM