question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.view.ViewGroup

See original GitHub issue

image

An uncaught Exception occurred on "main" thread.
com.tns.NativeScriptException: 
Calling js method finishUpdate failed

Error: java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.view.ViewGroup
    android.app.BackStackRecord.configureTransitions(BackStackRecord.java:1303)
    android.app.BackStackRecord.beginTransition(BackStackRecord.java:1016)
    android.app.BackStackRecord.run(BackStackRecord.java:729)
    android.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1539)
    android.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:688)
    com.tns.Runtime.callJSMethodNative(Native Method)
    com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1100)
    com.tns.Runtime.callJSMethodImpl(Runtime.java:982)
    com.tns.Runtime.callJSMethod(Runtime.java:969)
    com.tns.Runtime.callJSMethod(Runtime.java:953)
    com.tns.Runtime.callJSMethod(Runtime.java:945)
    com.tns.gen.android.support.v4.view.PagerAdapter_view_69_32_FragmentPagerAdapter.finishUpdate(PagerAdapter_view_69_32_FragmentPagerAdapter.java:92)
    android.support.v4.view.ViewPager.dataSetChanged(ViewPager.java:1062)
    android.support.v4.view.ViewPager$PagerObserver.onChanged(ViewPager.java:3089)
    android.support.v4.view.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:284)
    com.tns.Runtime.callJSMethodNative(Native Method)
    com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1100)
    com.tns.Runtime.callJSMethodImpl(Runtime.java:982)
    com.tns.Runtime.callJSMethod(Runtime.java:969)
    com.tns.Runtime.callJSMethod(Runtime.java:953)
    com.tns.Runtime.callJSMethod(Runtime.java:945)
    com.tns.gen.java.lang.Runnable.run(Runnable.java:15)
    android.os.Handler.handleCallback(Handler.java:751)
    android.os.Handler.dispatchMessage(Handler.java:95)
    android.os.Looper.loop(Looper.java:154)
    android.app.ActivityThread.main(ActivityThread.java:6119)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
File: "file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/tab-view/tab-view.js, line: 158, column: 41

StackTrace: 
	Frame: function:'FragmentPagerAdapter.finishUpdate', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/tab-view/tab-view.js', line: 158, column: 42
	Frame: function:'TabView.setAdapterItems', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/tab-view/tab-view.js', line: 448, column: 36
	Frame: function:'TabView.onUnloaded', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/tab-view/tab-view.js', line: 401, column: 14
	Frame: function:'', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 315, column: 92
	Frame: function:'ViewBase.callFunctionWithSuper', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 304, column: 9
	Frame: function:'ViewBase.callUnloaded', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 315, column: 14
	Frame: function:'ViewBase.unloadView', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 444, column: 18
	Frame: function:'', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 246, column: 19
	Frame: function:'LayoutBaseCommon.eachChildView', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js', line: 125, column: 26
	Frame: function:'ViewCommon.eachChild', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 868, column: 14
	Frame: function:'ViewBase.onUnloaded', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 245, column: 14
	Frame: function:'View.onUnloaded', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view/view.js', line: 218, column: 37
	Frame: function:'', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 315, column: 92
	Frame: function:'ViewBase.callFunctionWithSuper', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 304, column: 9
	Frame: function:'ViewBase.callUnloaded', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 315, column: 14
	Frame: function:'ViewBase.unloadView', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 444, column: 18
	Frame: function:'', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 246, column: 19
	Frame: function:'ContentView.eachChildView', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/content-view/content-view.js', line: 70, column: 13
	Frame: function:'PageBase.eachChildView', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/page/page-common.js', line: 120, column: 40
	Frame: function:'ViewCommon.eachChild', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 868, column: 14
	Frame: function:'ViewBase.onUnloaded', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 245, column: 14
	Frame: function:'View.onUnloaded', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view/view.js', line: 218, column: 37
	Frame: function:'', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 315, column: 92
	Frame: function:'ViewBase.callFunctionWithSuper', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 304, column: 9
	Frame: function:'ViewBase.callUnloaded', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 315, column: 14
	Frame: function:'FrameBase.raiseCurrentPageNavigatedEvents', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/frame/frame-common.js', line: 172, column: 22
	Frame: function:'FrameBase._updateBackstack', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/frame/frame-common.js', line: 148, column: 14
	Frame: function:'Frame.setCurrent', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 186, column: 18
	Frame: function:'', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/ui/frame/fragment.transitions.js', line: 578, column: 53
	Frame: function:'ZoneDelegate.invokeTask', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js', line: 398, column: 31
	Frame: function:'Zone.runTask', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js', line: 165, column: 47
	Frame: function:'ZoneTask.invoke', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js', line: 460, column: 38
	Frame: function:'timer', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js', line: 1636, column: 29
	Frame: function:'invoke', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/timer/timer.js', line: 19, column: 48
	Frame: function:'ZoneDelegate.invoke', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js', line: 365, column: 26
	Frame: function:'Zone.runGuarded', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js', line: 138, column: 47
	Frame: function:'', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js', line: 116, column: 29
	Frame: function:'run', file:'file:///data/data/org.nativescript.angularnativescript/files/app/tns_modules/tns-core-modules/timer/timer.js', line: 23, column: 13


	at com.tns.Runtime.callJSMethodNative(Native Method)
	at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1100)
	at com.tns.Runtime.callJSMethodImpl(Runtime.java:982)
	at com.tns.Runtime.callJSMethod(Runtime.java:969)
	at com.tns.Runtime.callJSMethod(Runtime.java:953)
	at com.tns.Runtime.callJSMethod(Runtime.java:945)
	at com.tns.gen.android.support.v4.view.PagerAdapter_view_69_32_FragmentPagerAdapter.finishUpdate(PagerAdapter_view_69_32_FragmentPagerAdapter.java:92)
	at android.support.v4.view.ViewPager.dataSetChanged(ViewPager.java:1062)
	at android.support.v4.view.ViewPager$PagerObserver.onChanged(ViewPager.java:3089)
	at android.support.v4.view.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:284)
	at com.tns.Runtime.callJSMethodNative(Native Method)
	at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1100)
	at com.tns.Runtime.callJSMethodImpl(Runtime.java:982)
	at com.tns.Runtime.callJSMethod(Runtime.java:969)
	at com.tns.Runtime.callJSMethod(Runtime.java:953)
	at com.tns.Runtime.callJSMethod(Runtime.java:945)
	at com.tns.gen.java.lang.Runnable.run(Runnable.java:15)
	at android.os.Handler.handleCallback(Handler.java:751)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:154)
	at android.app.ActivityThread.main(ActivityThread.java:6119)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.view.ViewGroup
	at android.app.BackStackRecord.configureTransitions(BackStackRecord.java:1303)
	at android.app.BackStackRecord.beginTransition(BackStackRecord.java:1016)
	at android.app.BackStackRecord.run(BackStackRecord.java:729)
	at android.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1539)
	at android.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:688)
	... 24 more

Run the above error on Android image image

Here’s my configuration. image

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:14

github_iconTop GitHub Comments

1reaction
cnotercommented, Jun 29, 2018

Please solve this ASAP!!!

1reaction
cnqiuxuecommented, Jun 22, 2018

@NickIliev How to handle a mistake like this

Read more comments on GitHub >

github_iconTop Results From Across the Web

android.widget.ImageView cannot be cast to android.view ...
I'm not sure why I keep getting this error. I tried wrapping the image view inside of a frame layout, but it doesnt...
Read more >
App Crash: android.widget.ImageView cannot be cast to ...
ImageView cannot be cast to android.view.ViewGroup android.app.FragmentTransition.configureTransitionsReordered(FragmentTransition.java:197) ...
Read more >
Android cannot be cast to android.widget.ImageView
I've got a script that will clean out the obj and bin folders to get rid of this error.
Read more >
Android Studio | cannot be cast to android.widget.ImageButton
java. lang. ClassCastException : androidx.appcompat. widget.AppCompatImageView cannot be cast to android. widget.ImageButtonThis error occurs ...
Read more >
Crash on bookmark removal -- java.lang.ClassCastException
Crash on bookmark removal -- java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.ImageView.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found