ClassNotFoundExceptiop when generating bindings

plugins

#1

Hello, today I tried to rebuild my project; but the build failed with the following output:

Searching for devices...
Starting Android emulator with image Nexus_7_Android_7
Waiting for emulator device initialization....
Executing before-liveSync hook from C:\repos\rolagroup-frontend\hooks\before-liveSync\nativescript-angular-sync.js
Executing before-prepare hook from C:\repos\rolagroup-frontend\hooks\before-prepare\nativescript-dev-sass.js
Found peer node-sass
Executing before-prepare hook from C:\repos\rolagroup-frontend\hooks\before-prepare\nativescript-dev-typescript.js
Found peer TypeScript 2.4.2
Preparing project...
Successfully prepared plugin nativescript-angular for android.
Successfully prepared plugin nativescript-gradient for android.
Successfully prepared plugin nativescript-textinputlayout for android.
Successfully prepared plugin nativescript-theme-core for android.
Successfully prepared plugin nativescript-unit-test-runner for android.
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin nativescript-intl for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Starting a Gradle Daemon, 6 stopped Daemons could not be reused, use --status for details
> Configuring > 0/3 projects > root project
 :config phase:  createDefaultIncludeFiles
> Configuring > 0/3 projects > root project
 :config phase:  addAarDependencies
        +adding dependency: C:\repos\rolagroup-frontend\platforms\android\libs\aar\widgets-release.aar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_cogdyo42bssvgewop3zivk6w6.run(C:\repos\rolagroup-frontend\platforms\android\build-tools\android-static-binding-generator\build.gradle:126)
:asbg:clean UP-TO-DATE
:deleteMetadata
:deleteFlavors
:deleteConfigurations UP-TO-DATE
:deleteGeneratedBindings UP-TO-DATE
:clean

BUILD SUCCESSFUL

Total time: 13.852 secs
Project successfully prepared (Android)
Executing after-prepare hook from C:\repos\rolagroup-frontend\hooks\after-prepare\nativescript-dev-sass.js
All SASS source files removed from app package
Executing after-prepare hook from C:\repos\rolagroup-frontend\hooks\after-prepare\nativescript-unit-test-runner.js
Building project...
> Configuring > 0/3 projects > root project
:config phase:  createDefaultIncludeFiles
        +found plugins: nativescript-textinputlayout
Renaming plugin directory to flavor name: C:\repos\rolagroup-frontend\platforms\android\src\nativescript-textinputlayout -> C:\repos\rolagroup-frontend\platforms\android\src\F0
        +found plugins: tns-core-modules-widgets
         + creating include.gradle file for C:\repos\rolagroup-frontend\platforms\android\configurations\tns-core-modules-widgets
Renaming plugin directory to flavor name: C:\repos\rolagroup-frontend\platforms\android\src\tns-core-modules-widgets -> C:\repos\rolagroup-frontend\platforms\android\src\F1

:config phase:  createPluginsConfigFile
         Creating product flavors include.gradle file in C:\repos\rolagroup-frontend\platforms\android/configurations folder...
> Configuring > 0/3 projects > root project > Resolving dependencies 'classpath'
:config phase:  pluginExtend
        +applying configuration from: C:\repos\rolagroup-frontend\platforms\android\configurations\include.gradle
        +applying configuration from: C:\repos\rolagroup-frontend\platforms\android\configurations\nativescript-textinputlayout\include.gradle
        +applying configuration from: C:\repos\rolagroup-frontend\platforms\android\configurations\tns-core-modules-widgets\include.gradle
> Configuring > 0/3 projects > root project
 :config phase:  addAarDependencies
        +adding dependency: C:\repos\rolagroup-frontend\platforms\android\libs\aar\widgets-release.aar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_cogdyo42bssvgewop3zivk6w6.run(C:\repos\rolagroup-frontend\platforms\android\build-tools\android-static-binding-generator\build.gradle:126)
:preBuild UP-TO-DATE
:preF0F1DebugBuild UP-TO-DATE
:checkF0F1DebugManifest
:preF0F1ReleaseBuild UP-TO-DATE
:prepareComAndroidSupportAnimatedVectorDrawable2531Library
:prepareComAndroidSupportAppcompatV72531Library
:prepareComAndroidSupportDesign2531Library
:prepareComAndroidSupportRecyclerviewV72531Library
:prepareComAndroidSupportSupportCompat2531Library
:prepareComAndroidSupportSupportCoreUi2531Library
:prepareComAndroidSupportSupportCoreUtils2531Library
:prepareComAndroidSupportSupportFragment2531Library
:prepareComAndroidSupportSupportMediaCompat2531Library
:prepareComAndroidSupportSupportV42531Library
:prepareComAndroidSupportSupportVectorDrawable2531Library
:prepareComAndroidSupportTransition2531Library
:prepareComDigitsSdkAndroidDigits1103Library
:prepareComFacebookAndroidFacebookAndroidSdk460Library
:prepareComGoogleAndroidGmsPlayServicesAuth840Library
:prepareComGoogleAndroidGmsPlayServicesBase840Library
:prepareComGoogleAndroidGmsPlayServicesBasement840Library
:prepareComTwitterSdkAndroidTweetComposer104Library
:prepareComTwitterSdkAndroidTweetUi1102Library
:prepareComTwitterSdkAndroidTwitter1132Library
:prepareComTwitterSdkAndroidTwitterCore167Library
:prepareIoFabricSdkAndroidFabric1311Library
:prepareRolagroupfrontendRuntimeUnspecifiedLibrary
:prepareWidgetsReleaseLibrary
:prepareF0F1DebugDependencies
:compileF0F1DebugAidl
:compileF0F1DebugRenderscript
:generateF0F1DebugBuildConfig
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:generateTypescriptDefinitions SKIPPED
:copyTypings SKIPPED
:asbg:generateInterfaceNamesList
:asbg:traverseJsFiles
:asbg:runAstParser
Running full build
finished with reading lines with js files
:asbg:generateBindings
Exception in thread "main" java.lang.ClassNotFoundException: Class: org.nativescript.widgets.image.Worker.OnImageLoadedListener
        at org.nativescript.staticbindinggenerator.Generator.getClass(Generator.java:709)
        at org.nativescript.staticbindinggenerator.Generator.collectInterfaceMethods(Generator.java:661)
        at org.nativescript.staticbindinggenerator.Generator.getPublicApi(Generator.java:212)
        at org.nativescript.staticbindinggenerator.Generator.writeBinding(Generator.java:326)
        at org.nativescript.staticbindinggenerator.Generator.generateBinding(Generator.java:117)
        at org.nativescript.staticbindinggenerator.Generator.processRows(Generator.java:157)
        at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:77)
        at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:54)
        at org.nativescript.staticbindinggenerator.Main.main(Main.java:15)
:asbg:generateBindings FAILED

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\repos\rolagroup-frontend\platforms\android\build-tools\android-static-binding-generator\build.gradle' line: 254

* What went wrong:
Execution failed for task ':asbg:generateBindings'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_141\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Here’s my packages.json:

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.rolagroupfrontend",
    "tns-android": {
      "version": "3.1.1"
    }
  },
  "scripts": {
    "lint": "tslint \"app/**/*.ts\""
  },
  "dependencies": {
    "@angular/animations": "4.2.5",
    "@angular/common": "4.2.5",
    "@angular/compiler": "4.2.5",
    "@angular/core": "4.2.5",
    "@angular/forms": "4.2.5",
    "@angular/http": "4.2.5",
    "@angular/platform-browser": "4.2.5",
    "@angular/router": "4.2.5",
    "nativescript-angular": "4.2.0",
    "nativescript-gradient": "^2.0.1",
    "nativescript-textinputlayout": "^2.0.0",
    "nativescript-theme-core": "1.0.4",
    "nativescript-unit-test-runner": "^0.3.4",
    "reflect-metadata": "0.1.10",
    "rxjs": "5.4.3",
    "tns-core-modules": "3.1.1",
    "validator": "^8.1.0",
    "zone.js": "0.8.16"
  },
  "devDependencies": {
    "@types/mocha": "^2.2.42",
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.4.5",
    "chai": "^4.1.1",
    "codelyzer": "3.1.2",
    "karma": "^1.7.0",
    "karma-chai": "^0.1.0",
    "karma-mocha": "^1.3.0",
    "karma-nativescript-launcher": "^0.4.0",
    "lazy": "1.0.11",
    "nativescript-dev-sass": "1.3.0",
    "nativescript-dev-typescript": "0.5.0",
    "tns-core-modules": "^3.0.0",
    "tns-platform-declarations": "^3.0.0",
    "node-sass": "4.5.3",
    "tns-core-modules-xsd-schema": "^1.7.2",
    "tslint": "5.6.0",
    "typescript": "2.4.2"
  }
}

The NativeScript CLI version is 3.1.3, tns-core-modules 3.1.1 and tns-android 3.1.1.

Last night it was working fine, the only thin I did was removing nativescript-tooltip and installing nativescript-textinputlayout. I though it was the latter plugin, but uninstalling it made no difference.

Also tried deleting node_modules and running npm install, same with tns platform remove android and tns platform add android but no luck.

Any ideas?

UPDATE: deleting the .gradle folder did not help either.


#2

This forum helped me, particularly these steps:

  1. Make sure you only have one version of Java installed (I have mine at C:\Program Files\Java\jdk1.8.0_181
  2. Delete platforms directory
  3. Execute tns run android