Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLVED: undefined is not a valid argument for 'in' (evaluating 'StopIteration' in goog.global) #220

Open
StankovicMarko opened this issue Apr 8, 2019 · 1 comment

Comments

@StankovicMarko
Copy link

StankovicMarko commented Apr 8, 2019

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

  1. lein prod-build
  2. 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/
  3. cd android
  4. ./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 #208 (comment)
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 #210 (comment) 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
facebook/metro#291
and .babelrc with
#208 (comment)

after that steps are
0. export ANDROID_HOME=~/Android/Sdk if it's already not there

  1. lein prod-build
  2. 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/
  3. (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

@StankovicMarko
Copy link
Author

StankovicMarko commented Apr 27, 2019

SOLVED:

steps are:

  1. export ANDROID_HOME=~/Android/Sdk
  2. export SENTE_ELIDE_JS_REQUIRE=true
  3. do this - Constant folding breaks some already minified code facebook/metro#291 (metro patch)
  4. do this - RN 57 lein prod-build crashes: "goog.global is not an Object." #208 (comment) (babelrc patch)
  5. 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 solving edit4 i made in PR.
  6. (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

@StankovicMarko StankovicMarko changed the title undefined is not a valid argument for 'in' (evaluating 'StopIteration' in goog.global) SOLVED: undefined is not a valid argument for 'in' (evaluating 'StopIteration' in goog.global) Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant