Exception thrown using Kinvey


#1

I just created a project in Sidekick using the blank template TypeScript version. This simple app runs fine when deployed on the device. Then I added the kinvey-nativescript-sdk again using Sidekick and this also went fine.

Following the docs I added this code:

import { Kinvey } from 'kinvey-nativescript-sdk';

Kinvey.initialize({
    appKey: 'xxx',
    appSecret: 'yyy'
}).then(function(activeUser) {
    console.log(activeUser);
}).catch(function(error) {
    console.log("error");
})

but an exception is thrown at runtime:

An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.firstApp00/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: 
Failed to find module: "tty", relative to: app/tns_modules/
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
	at android.app.ActivityThread.-wrap11(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
	at android.os.Handler.dispatchMessage(Handler.java:105)
	at android.os.Looper.loop(Looper.java:164)
	at android.app.ActivityThread.main(ActivityThread.java:6541)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: com.tns.NativeScriptException: Failed to find module: "tty", 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:1088)
	at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
	at com.tns.Runtime.callJSMethod(Runtime.java:957)
	at com.tns.Runtime.callJSMethod(Runtime.java:941)
	at com.tns.Runtime.callJSMethod(Runtime.java:933)
	at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:13)
	at android.app.Activity.performCreate(Activity.java:6975)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
	... 9 more

It has something to do with this: https://github.com/NativeScript/NativeScript/issues/195. Also tried to follow the proposed fix here https://github.com/NativeScript/NativeScript/issues/3858 but wasn’t able solve the issue.

Any help?


#2

I suspect this may be two separate issues - the Kinvey NativeScript SDK doesn’t seem to have any dependency on TTY (see here https://github.com/Kinvey/nativescript-sdk/blob/master/package.json). Did you try removing the TTY dependency from your package.json as was indicated in the GitHub issue you linked to?