NathanaelA/nativescript-websockets

Class Not Found error when requiring nativescript-websockets

Closed this issue · 4 comments

Hello! when I try to import the module in app.module.ts I get the following error:

java.lang.ClassNotFoundException: technology.master.nativescript.WebSocket

What could it be? Thank you!

PD: I'm using webpack and web code sharing.

Typically this means you haven't rebuild the application. Delete your platforms/android; then do a "tns platform add android" and then delete the app off the device. After you do a tns run android it should work.

Hi Nathanael, this seems to be an issue since upgrading to nativescript 5.
I have also tried your suggestion above but no joy.

JS: ERROR Error: java.lang.ClassNotFoundException: technology.master.nativescript.WebSocket
JS: java.lang.Class.classForName(Native Method)
JS: java.lang.Class.forName(Class.java:400)
JS: java.lang.Class.forName(Class.java:326)
JS: com.tns.Runtime.getClassForName(Runtime.java:1036)
JS: com.tns.ClassResolver.resolveClass(ClassResolver.java:27)
JS: com.tns.Runtime.resolveClass(Runtime.java:604)
JS: com.tns.Runtime.callJSMethodNative(Native Method)
JS: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1116)
JS: com.tns.Runtime.callJSMethodImpl(Runtime.java:996)
JS: com.tns.Runtime.callJSMethod(Runtime.java:983)
JS: com.tns.Runtime.callJSMethod(Runtime.java:967)
JS: com.tns.Runtime.callJSMethod(Runtime.java:959)
JS: com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:18)
JS: android.app.Activity.performCreate(Activity.java:6662)
JS: android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
JS: android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)

Further information: tns-core-modules > 5.0.1 causes this issue. Reverting to 5.01 has solved for now.

I had this same problem and i fixed with this
tns build android