re-natal
re-natal copied to clipboard
SOLVED: undefined is not a valid argument for 'in' (evaluating 'StopIteration' in goog.global)
Greetings
i have a problem with generating working apk. i am using
re-natal - 0.10.0
react-native-cli: 2.0.1
react-native: 0.57.7
node v11.12.0
npm 6.7.0
these are the steps i use to generate apk
-
lein prod-build
-
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
-
cd android
-
./gradlew assembleDebug
If i exclude bundle
step debug apk gives me unable to load script from assets 'index.android/bundle/ make sure your bundle is packaged correctly or you are running a packager server
i've added signing for release version as described in RN docs but apk generated with ./gradlew assembleRelease` crashes on startup
i've tried this https://github.com/drapanjanas/re-natal/issues/208#issuecomment-450976858 but node GC breaks and it doesn't compile.
Has anyone encountered this? How did you go about fixing it?
Kind regards
edit2
- if you do this with 'futureApp' example from read me and do the steps i listed here same error happens
edit3
- if you in index.android.js
file you change from goog.global=this
to goog.global=global
apk is made and you can run it but every time you type inside input field - it breaks with null is not an object (evaluating 'r.cljs$core$ifn$_invoce$aritiy$1')
edit4
- thought prod-build might be failing silently somewhere so i did https://github.com/drapanjanas/re-natal/issues/210#issuecomment-450978887 but that just gave me
ransform[stdout]: transform[stdout]: <--- Last few GCs ---> transform[stdout]: transform[stdout]: [24122:0x4125460] 69384 ms: Scavenge 1329.7 (1422.4) -> 1329.2 (1423.4) MB, 6.0 / 0.0 ms (average mu = 0.111, current mu = 0.080) allocation failure transform[stdout]: [24122:0x4125460] 69394 ms: Scavenge 1329.9 (1423.4) -> 1329.4 (1423.9) MB, 6.2 / 0.0 ms (average mu = 0.111, current mu = 0.080) allocation failure transform[stdout]: [24122:0x4125460] 69404 ms: Scavenge 1330.2 (1423.9) -> 1329.6 (1424.4) MB, 6.0 / 0.0 ms (average mu = 0.111, current mu = 0.080) allocation failure transform[stdout]: transform[stdout]: transform[stdout]: <--- JS stacktrace ---> transform[stdout]: transform[stdout]: ==== JS stack trace ========================================= transform[stdout]: transform[stdout]: 0: ExitFrame [pc: 0x3b31e7ccfc5d] transform[stdout]: 1: StubFrame [pc: 0x3b31e7cd0fca] transform[stdout]: Security context: 0x068bd761d9b1 <JSObject> transform[stdout]: 2: read_word(aka read_word) [0x11dce205a231] [0x3eb0871025b1 <undefined>:~2269] [pc=0x3b31e80aec42](this=0x3eb0871025b1 <undefined>) transform[stdout]: 3: next_token [0x11dce205a271] [0x3eb0871025b1 <undefined>:~2289] [pc=0x3b31e809ff66](this=0x11dce205a2b1 <Object map = 0x14cd6353151>,0x3eb0871025b1 <undefined>) transform[stdout]: 4: arguments a... transform[stdout]: transform[stderr]: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory transform[stderr]: transform[stderr]: Writing Node.js report to file: transform[stderr]: report.20190410.183057.24122.001.json transform[stderr]: transform[stderr]: Node.js report completed transform[stderr]: 1: 0x9590c0 node::Abort() [/home/marko/.nvm/versions/node/v11.12.0/bin/node] transform[stderr]: 2: 0x959d66 node::OnFatalError(char const*, char const*) [/home/marko/.nvm/versions/node/v11.12.0/bin/node] transform[stderr]: 3: 0xb39fae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/home/marko/.nvm/versions/node/v11.12.0/bin/node] transform[stderr]: 4: 0xb3a1e4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/home/marko/.nvm/versions/node/v11.12.0/bin/node] transform[stderr]: 5: 0xf39832 [/home/marko/.nvm/versions/node/v11.12.0/bin/node] transform[stderr]: 6: 0xf39938 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/home/marko/.nvm/versions/node/v11.12.0/bin/node] transform[stderr]: 7: 0xf46058 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/home/marko/.nvm/versions/node/v11.12.0/bin/node] transform[stderr]: 8: 0xf46b6b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/home/marko/.nvm/versions/node/v11.12.0/bin/node] transform[stderr]: 9: 0xf498a1 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/home/marko/.nvm/versions/node/v11.12.0/bin/node] transform[stderr]: 10: 0xf13ad4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/home/marko/.nvm/versions/node/v11.12.0/bin/node] transform[stderr]: 11: 0x11c9dde v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/home/marko/.nvm/versions/node/v11.12.0/bin/node] transform[stderr]: 12: 0x3b31e7ccfc5d
(GC of node is blown)
edit5
- i managed to create debug apk for FutureApp
but i had to patch metro with
https://github.com/facebook/metro/issues/291
and .babelrc with
https://github.com/drapanjanas/re-natal/issues/208#issuecomment-450976858
after that steps are 0. export ANDROID_HOME=~/Android/Sdk if it's already not there
- lein prod-build
- react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
- (cd android && ./gradlew clean && ./gradlew assembleDebug) and it works
Why those same steps don't work in main app - i have no idea the error i get is GC error shown in edit4
above
SOLVED:
steps are:
-
export ANDROID_HOME=~/Android/Sdk
-
export SENTE_ELIDE_JS_REQUIRE=true
- do this - https://github.com/facebook/metro/issues/291 (metro patch)
- do this - https://github.com/drapanjanas/re-natal/issues/208#issuecomment-450976858 (babelrc patch)
- bundle project -
node --expose-gc --max_old_space_size=8192 ./node_modules/react-native/local-cli/cli.js bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
(this prevents GC from blowing up thus solvingedit4
i made in PR. -
(cd android && ./gradlew clean && ./gradlew assembleDebug)
If anyone has any comments if this is wrong or steps should be different i am would appreciate it hopefully this will be helpful to beginners like myself