Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Project Fragment Transition throwing Exception when Build target used New API Level 21

Exception is:

"Unable to resolve superclass of L android/support/v4/app/FragmentTransitionCompat21$1;"

I am trying to Pop the last Fragment Transition from the Fragment Manager's Fragment Back Stack, using the following function:

getSupportFragmentManager().popBackStack(); ,

When I did this, function call throwing following Error. This is only happening when I used New Android API Version 21 as Build target.

Same Code work fine with Older API Version 20.

Error: Could not find superclass of 'android.support.v4.app.FragmentTransitionCompat21$1'

It seems an Inner Class in the Base class of 'FragmentTransitionCompat21'.

Error:

W/dalvikvm(1356): Unable to resolve superclass of Landroid/support/v4/app/FragmentTransitionCompat21$1; (1082)

W/dalvikvm(1356): Link of class 'Landroid/support/v4/app/FragmentTransitionCompat21$1;' failed

E/dalvikvm(1356): Could not find class 'android.support.v4.app.FragmentTransitionCompat21$1', referenced from method android.support.v4.app.FragmentTransitionCompat21.setEpicenter

W/dalvikvm(1356): VFY: unable to resolve new-instance 358 (Landroid/support/v4/app/FragmentTransitionCompat21$1;) in Landroid/support/v4/app/FragmentTransitionCompat21;

Does anybody find similar Error? please help how to solve this, thank you.

like image 970
skstar Avatar asked Nov 05 '14 09:11

skstar


3 Answers

It definitely referencing API 21 Version 4 Support Library, if you have any animations set on the transaction that has ObjectAnimator change it, also reference your animations from R.anim, or it will through and error.

like image 115
Kevin Crain Avatar answered Oct 15 '22 08:10

Kevin Crain


in few previous days i have also face this kind of err, then i try v7 appcompat with API 22 instead of android.support.v4.app.FragmentTransition.

have you try this one,

import android.app.FragmentTransaction;

there is code snip.

FragmentManager fm = getFragmentManager();
FragmentTransaction fragmentTransaction = fm.beginTransaction();
fragmentTransaction.addToBackStack("");
fragmentTransaction.replace(R.id.content_frame, Fr);
fragmentTransaction.commit();
like image 1
Alok Vishwakarma Avatar answered Oct 15 '22 09:10

Alok Vishwakarma


if you are trying to pop up fragment from stack inside the fragment you should use getChildFragmentManager instead of getfragmentManager.

[https://stackoverflow.com/questions/6847460/fragments-within-fragments][1]

like image 1
Mehran Zahiri Avatar answered Oct 15 '22 07:10

Mehran Zahiri