NativeScript / NativeScript/android

@Interfaces decorator gives an error "Error executing Static Binding Generator: Class not found"

Open
#1,638 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
563
Forks
144
Avg merge
10h 46m
Merged PRs (30d)
14

Description

Environment:
Nativescript: 6.7.8
tns-core-modules: 6.0.1
tns-andoird: 6.5.3

Issue:
I am implementing Java Interface in my Nativescript-angular application for android. I have added Java android plugin dependency in the app.gradle file. I get a build (tns build android) error for @Interfaces decorator.

Build error during "tns build android"
"Error executing Static Binding Generator: Class not found global.com.microsoft.identity.client.IPublicClientApplication.ISingleAccountApplicationCreatedListener"

If I execute below steps then I dont see any issue.

  1. "tns run android --no-hmr"
  2. Application built and started successfully
  3. Perform necessary @Interfaces related changes in the TS file
  4. Automatically starts the incremental build
  5. I dont see any error and my code works fine.

app.gradle:
dependencies {
implementation "com.microsoft.identity.client:msal:1.2.+"
}

TS file:
declare var global: any;

@Interfaces([global.com.microsoft.identity.client.IPublicClientApplication.ISingleAccountApplicationCreatedListener])
export class SingleAccount extends java.lang.Object {
mSingleAccountApp;
constructor() {
super();
// necessary when extending TypeScript constructors
return global.__native(this);
}
onCreated(application): void {
//some code
}
onError(exception): void {
////some code
}
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the clean tns build android failure and the successful tns run android --no-hmr flow. Inspect the app.gradle dependency and the TypeScript @Interfaces declaration, then trace the Static Binding Generator error for IPublicClientApplication.ISingleAccountApplicationCreatedListener. Done means the interface can be built successfully from a clean build, not only incrementally.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, typescript
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.