[Resolved] Release build fails with Hermes and RN 0.61.4 on mac
See original GitHub issueReact Native version: 0.61.4
Steps To Reproduce
here and here https://github.com/facebook/react-native/issues/25601#issuecomment-510856047
-
In
proguard-rules.pro
-keep class com.facebook.hermes.unicode.** { *; }
-
In build.gradle
classpath 'com.android.tools.build:gradle:3.4.2'
-
In gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
-
My updated react.gradle
-
Copied
node_modules/react-native/react.gradle
toandroid/app/react.gradle
-
updated
app/build.gradle
project.ext.react = [
entryFile: "index.android.js",
enableHermes: true,
hermesCommand: "../../node_modules/hermes-engine/%OS-BIN%/hermes",
]
def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);
apply from: "./react.gradle"
dependencies {
.
.
.
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
- npm install with package.json --only=dev
"hermes-engine": "^0.1.1",
- run
./android/gradlew clean
andreact-native run-android --variant=release
Error Trace
Describe what you expected to happen:
Release build should successfully go through and the app should not crash.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:17 (1 by maintainers)
Top Results From Across the Web
Highest scored 'react-native-hermes' questions - Stack Overflow
I created a release build of my app with react-native 0.61.2 and enabled Hermes. ... I've enabled Hermes for my RN (0.61.4) app...
Read more >Xcode12 build error. The linked fr… | Apple Developer Forums
This morning, the Xcode, which had been doing well, has been updated to version 12, and it has not been built since the...
Read more >Announcing React Native 0.64 with Hermes on iOS
Today we're releasing React Native 0.64 that ships with support for Hermes on iOS. Hermes opt-in on iOS.
Read more >Active questions tagged react-native+ios - Stack Overflow
I really don't know what is my problem and how can I fix that. React Native - iOS Release Builds taking time after...
Read more >react-native-reanimated - npm
More powerful alternative to Animated library for React Native.. Latest version: 2.13.0, last published: a month ago.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am facing same issue.
See screenshot attached. I am facing it in release build only. In both versions i.e. react-native 0.61.3 and 0.61.4.
sorry for a big file but there is a lot more but I skip it. @holospeed I’m using react native 61.5 version
_d(function(g,r,i,a,m,e,d){'use strict';var n=r(d[0])(r(d[1])),t=r(d[2]),o=r(d[3]),s=new Map,c={isBoldTextEnabled:function(){return Promise.resolve(!1)},isGrayscaleEnabled:function(){return Promise.resolve(!1)},isInvertColorsEnabled:function(){return Promise.resolve(!1)},isReduceMotionEnabled:function(){return new Promise(function(t,o){n.default?n.default.isReduceMotionEnabled(t):o(!1)})},isReduceTransparencyEnabled:function(){return Promise.resolve(!1)},isScreenReaderEnabled:function(){return new Promise(function(t,o){n.default?n.default.isTouchExplorationEnabled(t):o(!1)})},get fetch(){return this.isScreenReaderEnabled},addEventListener:function(n,o){var c;'change'===n||'screenReaderChanged'===n?c=t.addListener("touchExplorationDidChange",function(n){o(n)}):'reduceMotionChanged'===n&&(c=t.addListener("reduceMotionDidChange",function(n){o(n)})),s.set(o,c)},removeEventListener:function(n,t){var o=s.get(t);o&&(o.remove(),s.delete(t))},setAccessibilityFocus:function(n){o.sendAccessibilityEvent(n,o.getConstants().AccessibilityEventTypes.typeViewFocused)},announceForAccessibility:function(t){n.default&&n.default.announceForAccessibility(t)}};m.exports=c},7,[1,8,31,43]); ^~~~~~~ /Users/admin/Projects/lnchoba/android/app/build/generated/assets/react/release/index.android.bundle:25:3047: warning: the variable "DebuggerInternal" was not declared in function "value 14#" __d(function(g,r,i,a,m,e,d){'use strict';var t=r(d[0]),l=r(d[1]),u=r(d[2]),s=r(d[3]),n=r(d[4]),h=(r(d[5]),r(d[6])),o=r(d[7]),c=(r(d[8]),(function(){function c(){l(this,c),this._lazyCallableModules={},this._queue=[[],[],[],0],this._successCallbacks=new Map,this._failureCallbacks=new Map,this._callID=0,this._lastFlush=0,this._eventLoopStartTime=Date.now(),this._immediatesCallback=null,this.callFunctionReturnFlushedQueue=this.callFunctionReturnFlushedQueue.bind(this),this.callFunctionReturnResultAndFlushedQueue=this.callFunctionReturnResultAndFlushedQueue.bind(this),this.flushedQueue=this.flushedQueue.bind(this),this.invokeCallbackAndReturnFlushedQueue=this.invokeCallbackAndReturnFlushedQueue.bind(this)}return u(c,[{key:"callFunctionReturnFlushedQueue",value:function(t,l,u){var s=this;return this.__guard(function(){s.__callFunction(t,l,u)}),this.flushedQueue()}},{key:"callFunctionReturnResultAndFlushedQueue",value:function(t,l,u){var s,n=this;return this.__guard(function(){s=n.__callFunction(t,l,u)}),[s,this.flushedQueue()]}},{key:"invokeCallbackAndReturnFlushedQueue",value:function(t,l){var u=this;return this.__guard(function(){u.__invokeCallback(t,l)}),this.flushedQueue()}},{key:"flushedQueue",value:function(){var t=this;this.__guard(function(){t.__callImmediates()});var l=this._queue;return this._queue=[[],[],[],this._callID],l[0].length?l:null}},{key:"getEventLoopRunningTime",value:function(){return Date.now()-this._eventLoopStartTime}},{key:"registerCallableModule",value:function(t,l){this._lazyCallableModules[t]=function(){return l}}},{key:"registerLazyCallableModule",value:function(t,l){var u,s=l;this._lazyCallableModules[t]=function(){return s&&(u=s(),s=null),u}}},{key:"getCallableModule",value:function(t){var l=this._lazyCallableModules[t];return l?l():null}},{key:"callNativeSyncHook",value:function(t,l,u,s,n){this.processCallbacks(t,l,u,s,n);try{return g.nativeCallSyncHook(t,l,u)}catch(t){throw'object'==typeof t&&null!=t&&void 0===t.framesToPop&&/^Exception in HostFunction: /.test(t.message)&&(t.framesToPop=2),t}}},{key:"processCallbacks",value:function(t,l,u,s,n){(s||n)&&(s&&u.push(this._callID<<1),n&&u.push(this._callID<<1|1),this._successCallbacks.set(this._callID,n),this._failureCallbacks.set(this._callID,s)),this._callID++}},{key:"enqueueNativeCall",value:function(t,l,u,s,h){this.processCallbacks(t,l,u,s,h),this._queue[0].push(t),this._queue[1].push(l),this._queue[2].push(u);var o=Date.now();if(g.nativeFlushQueueImmediate&&o-this._lastFlush>=5){var c=this._queue;this._queue=[[],[],[],this._callID],this._lastFlush=o,g.nativeFlushQueueImmediate(c)}n.counterEvent('pending_js_to_native_queue',this._queue[0].length),this.__spy&&this.__spy({type:1,module:t+'',method:l,args:u})}},{key:"createDebugLookup",value:function(t,l,u){}},{key:"setImmediatesCallback",value:function(t){this._immediatesCallback=t}},{key:"__guard",value:function(t){if(this.__shouldPauseOnThrow())t();else try{t()}catch(t){s.reportFatalError(t)}}},{key:"__shouldPauseOnThrow",value:function(){return'undefined'!=typeof DebuggerInternal&&!0===DebuggerInternal.shouldPauseOnThrow}},{key:"__callImmediates",value:function(){n.beginEvent('JSTimers.callImmediates()'),null!=this._immediatesCallback&&this._immediatesCallback(),n.endEvent()}},{key:"__callFunction",value:function(t,l,u){this._lastFlush=Date.now(),this._eventLoopStartTime=this._lastFlush,this.__spy?n.beginEvent(t+"."+l+"("+o(u)+")"):n.beginEvent(t+"."+l+"(...)"),this.__spy&&this.__spy({type:0,module:t,method:l,args:u});var s=this.getCallableModule(t);h(!!s,'Module %s is not a registered callable module (calling %s)',t,l),h(!!s[l],'Method %s does not exist on module %s',l,t);var c=s[l].apply(s,u);return n.endEvent(),c}},{key:"__invokeCallback",value:function(l,u){this._lastFlush=Date.now(),this._eventLoopStartTime=this._lastFlush;var s=l>>>1,n=1&l?this._successCallbacks.get(s):this._failureCallbacks.get(s);n&&(this._successCallbacks.delete(s),this._failureCallbacks.delete(s),n.apply(void 0,t(u)))}}],[{key:"spy",value:function(t){c.prototype.__spy=!0===t?function(t){console.log((0===t.type?'N->JS':'JS->N')+" : "+(t.module?t.module+'.':'')+t.method+"("+JSON.stringify(t.args)+")")}:!1===t?null:t}}]),c})());m.exports=c},19,[20,24,25,26,27,28,3,29,4]); ^~~~~~~~~~~~~~~~ /Users/admin/Projects/lnchoba/android/app/build/generated/assets/react/release/index.android.bundle:89:57098: warning: the variable "setTimeout" was not declared in function "Pi" __d(function(e,t,n,r,i,l,a){"use strict";var o=t(a[0]);t(a[1]);var u=t(a[2]),c=t(a[3]),s=t(a[4]);function f(e){return e.name="Invariant Violation",e}var d=null,p={};function h(){if(d)for(var e in p){var t=p[e],n=d.indexOf(e);if(!(-1<n))throw f(Error("EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `"+e+"`."));if(!g[n]){if(!t.extractEvents)throw f(Error("EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `"+e+"` does not."));for(var r in g[n]=t,n=t.eventTypes){var i=void 0,l=n[r],a=t,o=r;if(v.hasOwnProperty(o))throw f(Error("EventPluginHub: More than one plugin attempted to publish the same event name, `"+o+"`."));v[o]=l;var u=l.phasedRegistrationNames;if(u){for(i in u)u.hasOwnProperty(i)&&m(u[i],a);i=!0}else l.registrationName?(m(l.registrationName,a),i=!0):i=!1;if(!i)throw f(Error("EventPluginRegistry: Failed to publish event `"+r+"` for plugin `"+e+"`."))}}}}function m(e,t){if(y[e])throw f(Error("EventPluginHub: More than one plugin attempted to publish the same registration name, `"+e+"`."));y[e]=t}var g=[],v={},y={};function b(e,t,n,r,i,l,a,o,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(e){this.onError(e)}}var T=!1,E=null,x=!1,w=null,S={onError:function(e){T=!0,E=e}};function k(e,t,n,r,i,l,a,o,u){T=!1,E=null,b.apply(S,arguments)}function C(e,t,n,r,i,l,a,o,u){if(k.apply(this,arguments),T){if(!T)throw f(Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue."));var c=E;T=!1,E=null,x||(x=!0,w=c)}}var _=null,P=null,R=null;function N(e,t,n){var r=e.type||"unknown-event";e.currentTarget=R(n),C(r,t,void 0,e),e.currentTarget=null}function I(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))throw f(Error("executeDirectDispatch(...): Invalid `event`."));return e.currentTarget=t?R(n):null,t=t?t(e):null,e.currentTarget=null,e._dispatchListeners=null,e._dispatchInstances=null,t}function U(e,t){if(null==t)throw f(Error("accumulateInto(...): Accumulated items must not be null or undefined."));return null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function z(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}var M=null;function A(e){if(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(var r=0;r<t.length&&!e.isPropagationStopped();r++)N(e,t[r],n[r]);else t&&N(e,t,n);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}var D=function(e){if(d)throw f(Error("EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."));d=Array.prototype.slice.call(e),h()},F=function(e){var t,n=!1;for(t in e)if(e.hasOwnProperty(t)){var r=e[t];if(!p.hasOwnProperty(t)||p[t]!==r){if(p[t])throw f(Error("EventPluginRegistry: Cannot inject two different event plugins using the same name, `"+t+"`."));p[t]=r,n=!0}}n&&h()};function O(e,t){var n=e.stateNode;if(!n)return null;var r=_(n);if(!r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw f(Error("Expected `"+t+"` listener to be a function, instead got a value of `"+typeof n+"` type."));return n}function j(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function W(e,t,n){for(var r=[];e;)r.push(e),e=j(e);for(e=r.length;0<e--;)t(r[e],"captured",n);for(e=0;e<r.length;e++)t(r[e],"bubbled",n)}function H(e,t,n){(t=O(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=U(n._dispatchListeners,t),n._dispatchInstances=U(n._dispatchInstances,e))}function Q(e){e&&e.dispatchConfig.phasedRegistrationNames&&W(e._targetInst,H,e)}function B(e){if(e&&e.dispatchConfig.phasedRegistrationNames){var t=e._targetInst;W(t=t?j(t):null,H,e)}}function V(e){if(e&&e.dispatchConfig.registrationName){var t=e._targetInst;if(t&&e&&e.dispatchConfig.registrationName){var n=O(t,e.dispatchConfig.registrationName);n&&(e._dispatchListeners=U(e._dispatchListeners,n),e._dispatchInstances=U(e._dispatchInstances,t))}}}function L(){return!0}function Y(){return!1}function X(e,t,n,r){for(var i in this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n,e=this.constructor.Interface)e.hasOwnProperty(i)&&((t=e[i])?this[i]=t(n):"target"===i?this.target=r:this[i]=n[i]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?L:Y,this.isPropagationStopped=Y,this}function q(e,t,n,r){if(this.eventPool.length){var i=this.eventPool.pop();return this.call(i,e,t,n,r),i}return new this(e,t,n,r)}function $(e){if(!(e instanceof this))throw f(Error("Trying to release an event instance into a pool of a different type."));e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function G(e){e.eventPool=[],e.getPooled=q,e.release=$}o(X.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=L)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=L)},persist:function(){this.isPersistent=L},isPersistent:Y,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefau