1

I have a Nativescript core (js) project that I've been working on for nearly two years. I am up to date with version 6.7.8. I have been building fine for both Android and iOS, but recently needed to install Android Studio. I was nervous about doing this, since my existing Android support was via command line installs (via brew on my Mac) and I figured Android Studio might mess up that environment.

I recorded my JAVA_HOME and ANROID_HOME environment variables so that I could reset them if that should occur. I installed Android Studio, and built a sample Android app and tested it and it all worked as expected. I checked the values of my JAVA_HOME and ANDROID_HOME as saw they were not changed. I also noticed, happily, that Android Studio recognized the emulator VMs I had painstakingly set up with the command line previously.

So I was feeling pretty good. But when I tried to build my NativeScript project again, all I got was errors. Oddly, the errors would change between invocations, which is weird. No real explanation was given for the failures. What's weirder is that I then discovered I could no longer build for iOS either!! What did installing Android Studio have to do with THAT?

I found that I could still build a simple Nativescript test app I had lying around. Played around with this for clues, but didn't find any, so I decided to "start over" with my main project by creating a new one with tns create and then migrating the app files in until I found a breaking point.

This went without notable incident until I had pretty much copied over all the files (installing the plugins these required as I went) except for those files in a directory called 'settings' (which holds code for the 'settings' portion of the app). Without this folder, I can build and run the app (except of course, without settings functionality). the mere creation of the folder 'settings' however is enough to make the build fail. Maybe. The thing is, if I practice the definition of insanity by repeating my same steps (try it with, try it without, try it with again) I can get it to work for a bit. I got as far as being able to actually add some of the source files to the folder with success, but then it would subsequently fail and the only sure thing is to roll it back to a point without the 'settings' folder. I even tried renaming the 'settings' folder, but it doesn't seem to be magically related to the name of this directory.

It doesn't seem to matter what's in the files I might add to the folder, and they might be .js files or .xml files.

The error reported is:

Error executing Static Binding Generator: Couldn't find '/Users/sohmert/tbd/wanwan/platforms/android/build-tools/sbg-bindings.txt' bindings input file. Most probably there's an error in the JS Parser execution. You can run JS Parser with verbose logging by executing "node '/Users/sohmert/tbd/wanwan/platforms/android/build-tools/jsparser/js_parser.js' enableErrorLogging".
Detailed log here: /Users/sohmert/tbd/wanwan/platforms/android/build-tools/runSbg.log

the runSbg.log mentioned simply contains this same text, so no help there. running the js_parser.js with enableErrorLogging as noted doesn't seem to do anything either. I have done the "delete the node_modules/ hooks/ platforms/" dance and that sometimes seems to help, but not conclusively. The success / non-success seems very random and capricious.

I have run with --log trace at the end of the build command and that doesn't reveal anything either. Here is the relevant section dumped from there:

16:04:21.598 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute exec for :app:runSbg' started
16:04:21.599 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin/java''. Working directory: /Users/sohmert/tbd/wanwan/platforms/android/build-tools Command: /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -jar static-binding-generator.jar
16:04:21.599 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Environment for process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin/java'': {PATH=/usr/local/opt/node@12/bin:~/.npm-global/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin, NVM_RC_VERSION=, JAVA_MAIN_CLASS_14515=org.gradle.wrapper.GradleWrapperMain, APP_ICON_14515=/Users/sohmert/tbd/wanwan/platforms/android/media/gradle.icns, JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home, TERM=xterm-256color, LANG=en_US.UTF-8, ANDROID_HOME=/usr/local/share/android-sdk, LOGNAME=sohmert, TERM_PROGRAM_VERSION=433, PWD=/Users/sohmert/tbd/wanwan/platforms/android, XPC_SERVICE_NAME=0, NVM_CD_FLAGS=-q, SHELL=/bin/zsh, NVM_DIR=/Users/sohmert/.nvm, TERM_PROGRAM=Apple_Terminal, OLDPWD=/Users/sohmert/tbd/wanwan/platforms/android, USER=sohmert, TMPDIR=/var/folders/cw/jr7g3xr96g73y_pgrxprdg3h0000gn/T/, SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.LPNDVV0GE6/Listeners, XPC_FLAGS=0x0, TERM_SESSION_ID=2D8B360C-6A55-4F5E-84F9-4C6AC8A075D6, APP_NAME_14515=Gradle, __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0, SHLVL=1, HOME=/Users/sohmert}
16:04:21.599 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
16:04:21.599 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command '/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin/java'.
16:04:21.602 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED
16:04:21.602 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled...
16:04:21.602 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin/java''
16:04:23.015 [QUIET] [system.out] 
16:04:23.015 [QUIET] [colouredOutputLogger] Error executing Static Binding Generator: Couldn't find '/Users/sohmert/tbd/wanwan/platforms/android/build-tools/sbg-bindings.txt' bindings input file. Most probably there's an error in the JS Parser execution. You can run JS Parser with verbose logging by executing "node '/Users/sohmert/tbd/wanwan/platforms/android/build-tools/jsparser/js_parser.js' enableErrorLogging".
16:04:23.046 [QUIET] [colouredOutputLogger] Detailed log here: /Users/sohmert/tbd/wanwan/platforms/android/build-tools/runSbg.log
16:04:23.046 [QUIET] [colouredOutputLogger] 
16:04:23.047 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
16:04:23.047 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin/java'' finished with exit value 1 (state: FAILED)
16:04:23.047 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Execute exec for :app:runSbg'
16:04:23.047 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute exec for :app:runSbg' completed

I find that I can still build for iOS, though, so that's a relief and an improvement from where I started (haven't tried with all the files put back, though, but I'm guessing it will work).

But what is runSbg doing here and why is is screwed up?

More importantly (to me), how do I fix it or work around it? I was supposed to release this app in the next couple weeks.

tremho
  • 130
  • 1
  • 1
  • 8

0 Answers0