J A
J A

Reputation: 15

Getting error after update NativeScript to 5.0.0

I am new to NativeScript. After I have updated NativeScript to 5.0.0, When I create default project and run using tns run android command, It is giving me following error :

 System.err: com.tns.NativeScriptException:
System.err: Calling js method onViewAttachedToWindow failed
System.err: TypeError: this._context.getSupportFragmentManager is not a function
System.err: File: "file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/core/view/view.js, line: 190, column: 46
System.err: StackTrace:
System.err:     Frame: function:'View._getRootFragmentManager', file:'file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/core/view/view.js', line: 190, column: 47
System.err:     Frame: function:'View._getFragmentManager', file:'file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/core/view/view.js', line: 215, column: 32
System.err:     Frame: function:'Frame._processNextNavigationEntry', file:'file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 134, column: 28
System.err:     Frame: function:'Frame._onAttachedToWindow', file:'file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 118, column: 14
System.err:     Frame: function:'AttachListener.onViewAttachedToWindow', file:'file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 35, column: 27
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1116)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:996)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:983)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:967)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:959)
System.err:     at com.tns.gen.java.lang.Object_frame_29_36_AttachListener.onViewAttachedToWindow(Object_frame_29_36_AttachListener.java:17)
System.err:     at android.view.View.dispatchAttachedToWindow(View.java:13554)
System.err:     at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2690)
System.err:     at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2697)
System.err:     at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2697)
System.err:     at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2697)
System.err:     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1322)
System.err:     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1084)
System.err:     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5990)
System.err:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
System.err:     at android.view.Choreographer.doCallbacks(Choreographer.java:580)
System.err:     at android.view.Choreographer.doFrame(Choreographer.java:550)
System.err:     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
System.err:     at android.os.Handler.handleCallback(Handler.java:739)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
System.err:     at android.os.Looper.loop(Looper.java:135)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:5343)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
ActivityManager: Process org.nativescript.DemoApp (pid 22172) has died

Please help me with the answer. I am facing this issue since I have updated my NativeScript Version.

Upvotes: 0

Views: 423

Answers (3)

J A
J A

Reputation: 15

I have solved this issue. Actually I was having issue with AndroidStudio. By doing ClearCache in AndroidStudio my problem get solved. It might be space issue that AndroidStudio was occupying in disc so my NativeScript application was not getting enough space.

Upvotes: 0

user10655801
user10655801

Reputation: 41

Do you have something like

class MainActivity extends android.app.Activity {

I updated the Activity to AppCompatActivity for nativescript version 5

class Activity extends android.support.v7.app.AppCompatActivity {

and the error is gone.

but if you have startActivityForResult, maybe you will get other new errors then.

Upvotes: 3

Nick Iliev
Nick Iliev

Reputation: 9670

Most likely you have upgraded just the NativeScript CLI and not the project's dependencies and runtime. Follow the detailed upgrade instruction in this documentation section and make sure that you have migrated your entire project by updating the runtimes ('tns-android' and/or 'tns-ios'), the modules ('tns-core-modules') and all related plugins/dependencies.

Upvotes: 0

Related Questions