android icon indicating copy to clipboard operation
android copied to clipboard

Couldn't find 'platforms/android/build-tools/sbg-bindings.txt' bindings input file

Open NickIliev opened this issue 5 years ago • 14 comments

@rakeshgirase commented on Tue Jun 04 2019

Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.4.0
  • Cross-platform modules: 5.4.1
  • Android Runtime: 5.4.0
  • iOS Runtime: NA
  • Plugin(s):

Describe the bug

After upgrade to NS 5.4.0, when Legacy Workflow is disabled in nsconfig.json file, local and cloud build breaks with following error message:

Exception in thread "main" java.io.IOException: Couldn't find '/home/circleci/repo/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 '/home/circleci/repo/platforms/android/build-tools/jsparser/js_parser.js' enableErrorLogging".
	at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:126)
	at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:97)
	at org.nativescript.staticbindinggenerator.Main.main(Main.java:48)

The build runs fine if legacy Workflow is switched on. I updated the webpack.config.js file as mentioned in https://docs.nativescript.org/releases/upgrade-instructions but the build still fails. If required complete logs can be found at https://circleci.com/gh/rakeshgirase/CloudBuild/115. Earlier successful build is which uses legacyWorkflow and passes https://circleci.com/gh/rakeshgirase/CloudBuild/103.

To Reproduce

Simply clone sample project https://github.com/rakeshgirase/CloudBuild.git and run tns build android

Expected behavior The build should be successful when legacy workflow is disabled.

Sample project

The sample project can be found at https://github.com/rakeshgirase/CloudBuild.git.

Additional context

I asked getting help on this on SO as well https://stackoverflow.com/questions/56379865/nativescript-5-4-0-build-fails-with-couldnt-find-sbg-bindings-txt but no luck.

NickIliev avatar Jun 04 '19 11:06 NickIliev

any solution?

Omi231 avatar Jun 13 '19 07:06 Omi231

@Omi231 after cloning the project and running tns build android I get a different error:

ERROR in Entry module not found: Error: Can't resolve 'awesome-typescript-loader' in '/Users/trifonov/Work/tmp/CloudBuild/app'

but after running the command suggested in the CLI output

./node_modules/.bin/update-ns-webpack --configs

the error disappears and the app is successfully built.

vtrifonov avatar Jun 13 '19 08:06 vtrifonov

Now the project is build successfully locally but still cloud build fails with the same error. Not sure why is the difference. Tried just tns build android on cloud but same result https://circleci.com/gh/rakeshgirase/CloudBuild/121.

rakeshgirase avatar Jun 13 '19 18:06 rakeshgirase

are you cleaning the workspace before the run

vtrifonov avatar Jun 14 '19 08:06 vtrifonov

This run is on cloud so I think every run is a fresh run.

rakeshgirase avatar Jun 14 '19 08:06 rakeshgirase

can you add running

node '/home/circleci/repo/platforms/android/build-tools/jsparser/js_parser.js' enableErrorLogging 

after the build fails

vtrifonov avatar Jun 14 '19 14:06 vtrifonov

@vakrilov Having the same issue. Ran js_parser.js after the build fails.

Here's the output..

    throw err;
    ^

Error: Cannot find module '/home/circleci/repo/platforms/android/build-tools/jsparser/js_parser.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)```

dondre avatar Jun 24 '19 06:06 dondre

@dondre seems that when you run the command the folder is already clean up, so can you check before executing it that the folder exists.

vtrifonov avatar Jun 24 '19 08:06 vtrifonov

I realised that we need to clean the cached folder for every run to get away from this error which needs to be fixed.

rakeshgirase avatar Jun 25 '19 21:06 rakeshgirase

Can you reproduce this on you local machine and if yes what are the steps?

vtrifonov avatar Jun 26 '19 07:06 vtrifonov

Please refer to cloud build https://circleci.com/gh/rakeshgirase/CloudBuild/123 which I ran by clearing the cache (this i do by changing the cache version in config.yml file) so the build has generated apk file successfully whereas when I rebuild it again without any code changes then it fails with the same error. Please refer to build https://circleci.com/gh/rakeshgirase/CloudBuild/124. The build again passes when the cache version is changed. I am not able to replicate this in my local environment

rakeshgirase avatar Jun 26 '19 15:06 rakeshgirase

@vtrifonov I was able to solve the problem by running update-ns-webpack as you suggested. The last step was removing the existing node_modules and platforms folders and doing a fresh prepare and build afterwards.

dondre avatar Jun 27 '19 01:06 dondre

@rakeshgirase the problem is that when using the circle CI cache it copies the node_modules folder from the previous build and npm install does nothing as all the packages are present, but we need some post install scripts to be run as they are adding some hooks needed by the NativeScript CLI, so there are two possible solutions for the problem:

  1. Remove hooks/ from the .gitignore file and check in the hooks folder in the repo.
  2. [Recommended] Add additional build step in the Circle CI - npm rebuild which will trigger all the postinstall scripts which will add the needed hooks.

vtrifonov avatar Jun 28 '19 08:06 vtrifonov

I had this error on local build after updating and for me the solution was this one: https://stackoverflow.com/a/56740058

From the project root run ./node_modules/.bin/update-ns-webpack --deps --configs This updates package.json and node_modules. Then I removed the following folders: node_modules, platform, hooks And do a clean run: tns run android

exebetche avatar Aug 27 '19 09:08 exebetche

I am having the same issue, but the solution https://github.com/NativeScript/android-runtime/issues/1385#issuecomment-525223822 did not work for me at all, as I get the same error every single time, no matter how many times I delete those folders and do tns clean.

LordMilutin avatar Nov 21 '22 10:11 LordMilutin

There is no update-ns-webpack

AndreThompson-Atlow avatar Mar 24 '23 19:03 AndreThompson-Atlow

@AndreThompson-Atlow that is no longer necessary with @nativescript/webpack versions 5.0.0+.

rigor789 avatar Mar 24 '23 22:03 rigor789

I am getting this behavior on NS 8 and @nativescript/webpack v 5.0.17

allayGerald avatar Sep 01 '23 06:09 allayGerald