Android-runtime: App crash: NativeScript application not initialized correctly. Cannot create extended JS wrapper

Created on 23 Mar 2016  路  8Comments  路  Source: NativeScript/android-runtime

_Moved from https://github.com/NativeScript/NativeScript/issues/1779#issuecomment-200002211_

I still have this issue. My application fails to run after upgrading to 1.7. I am using android@next for the platform as mentioned in previous post. This is on Windows.

The application crashed because of an uncaught exception. You can look at "stackTrace" or "nativeException" for more detailed information about the exception. java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: NativeScript application not initialized correctly. Cannot create extended JS wrapper. at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4556) at android.app.ActivityThread.access$1500(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: com.tns.NativeScriptException: NativeScript application not initialized correctly. Cannot create extended JS wrapper. at com.tns.Platform.createJSInstanceNative(Native Method) at com.tns.Platform.createJSInstance(Platform.java:368) at com.tns.Platform.initInstance(Platform.java:343) at com.tns.RuntimeHelper.initRuntime(RuntimeHelper.java:112) at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:15) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4553) ... 9 more

Most helpful comment

@bfattori - you need to have the tns-core-modules also updated to v1.7.x --

npm install tns-core-modules@latest --save 

From inside your main app project folder...

All 8 comments

Hi @rajarameshvarma

It seems this is a different error from the original issue.

com.tns.NativeScriptException: Cannot find object id for instance=com.tns.NativeScriptApplication@21e5ccb0

Can you provide more detail so we can try to reproduce it? Also, yesterday we released 1.7.1 and I would like to know if the problem persists with the new version.

Thank you @slavchev Upgrading the project to 1.7.1 solved all the issues.

Hello @slavchev , after i am test android@next, i get this error. also i have use nativescript 1.7.1 but still error.
any sugestions.
thanks

i am reinstall nativescript and install again also not solve this error. I decide to recreate project and it solved this error.

I'm getting this issue when I try to run it on Android. It complains about:

Successfully deployed on device with identifier 'emulator-5554'.
04-19 11:40:39.280  2656  2656 W System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: NativeScript application not initialized correctly. Cannot create extended JS wrapper.
04-19 11:40:39.281  2656  2656 W System.err: Caused by: com.tns.NativeScriptException: NativeScript application not initialized correctly. Cannot create extended JS wrapper.
04-19 11:40:39.281  2656  2656 W System.err:    at com.tns.Platform.createJSInstanceNative(Native Method)
04-19 11:40:39.281  2656  2656 W System.err:    at com.tns.Platform.createJSInstance(Platform.java:368)

I've upgraded to 1.7.1, for the most part (see https://github.com/NativeScript/nativescript-cli/issues/1645 as I have not been able to _complete_ the install of 1.7.1)

@bfattori - you need to have the tns-core-modules also updated to v1.7.x --

npm install tns-core-modules@latest --save 

From inside your main app project folder...

You would think that either this page:
https://docs.nativescript.org/start/quick-setup

Or maybe this page:
https://docs.nativescript.org/start/ns-setup-os-x

Would mention that command somewhere?

And, especially, running tns doctor would have recognized that the latest tns-core modules weren't installed. But it didn't. It said everything was fine.

@NathanaelA This fixed my issue.

@bfattori -- glad to help.

TNS Doctor, not recognizing version difference; that is an excellent idea; I'll drop a feature enhancement request in the repo for that.

The docs for upgrading NS can be found here: https://docs.nativescript.org/releases/upgrade-instructions

Was this page helpful?
0 / 5 - 0 ratings