EddyVerbruggen / nativescript-bluetooth-demo

30 stars 21 forks source link

An uncaught Exception occurred on "main" thread. #22

Closed xinthose closed 5 years ago

xinthose commented 5 years ago

tns install Output:

LOG from device XT1585: An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.preview/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Failed to find module: "nativescript-bluetooth", relative to: app/tns_modules/
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2671)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2736)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6154)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: com.tns.NativeScriptException: Failed to find module: "nativescript-bluetooth", relative to: app/tns_modules/
        at com.tns.Module.resolvePathHelper(Module.java:146)
        at com.tns.Module.resolvePath(Module.java:55)
        at com.tns.Runtime.callJSMethodNative(Native Method)
        at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1116)
        at com.tns.Runtime.callJSMethodImpl(Runtime.java:996)
        at com.tns.Runtime.callJSMethod(Runtime.java:983)
        at com.tns.Runtime.callJSMethod(Runtime.java:967)
        at com.tns.Runtime.callJSMethod(Runtime.java:959)
        at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:18)
        at android.app.Activity.performCreate(Activity.java:6683)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2624)
        ... 9 more

OS: Windows 10 Device: Android Phone Build: Sync to Playground --> Nativescript Playground App --> scan QR code

EddyVerbruggen commented 5 years ago

Usually when "Failed to find module: "nativescript-bluetooth", relative to: app/tns_modules/" is thrown, I advise to do:

tns plugin add nativescript-bluetooth
rm -rf platforms
tns run android

However, it seems like you're not building with the NativeScript CLI, and the Preview/Playground app probably doesn't support this plugin.