2

My android tv app works fine with these versions:

compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:preference-leanback-v17:23.2.1'
compile 'com.android.support:leanback-v17:23.2.1'

But once I upgrade them to:

compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:preference-leanback-v17:25.0.1'
compile 'com.android.support:leanback-v17:25.0.1'

I see a crash everytime I open a guidedStepFragment. Here are the crash logs:

java.lang.RuntimeException: Unable to start activity ComponentInfo{...}: android.view.InflateException: Binary XML file line #18: Invalid float: "?2130772240" at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5422) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: android.view.InflateException: Binary XML file line #18: Invalid float: "?2130772240" at android.view.LayoutInflater.inflate(LayoutInflater.java:539) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.support.v17.leanback.widget.GuidedActionsStylist.onCreateView(GuidedActionsStylist.java:409) at android.support.v17.leanback.app.GuidedStepFragment.onCreateView(GuidedStepFragment.java:1044) at android.app.Fragment.performCreateView(Fragment.java:2220) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:973) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1148) at android.app.BackStackRecord.run(BackStackRecord.java:793) at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1535) at android.app.FragmentController.execPendingActions(FragmentController.java:325) at android.app.Activity.performStart(Activity.java:6267) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5422)

The app crashes while creating a view (onCreateView) for guidedStepFragment.

Any ideas about how to fix it?

Vpd
  • 235
  • 2
  • 12

3 Answers3

1

In my case, I am using my own custom style for GuidedStepFragment that inherits from Theme.LeanbackBase.

Instead I made my custom style to inherit from Theme.Leanback.GuidedStep .This change fixed my problem.

Vpd
  • 235
  • 2
  • 12
0

You might want to check Adding a Guided Step wherein it mentions about the use of android.support.v17.leanback.app that supports classes for building Leanback user experiences. As mentioned in the documentation,

Leanback contains a mixture of higher level building blocks such as Fragments in the android.support.v17.leanback.app package. Notable examples are the BrowseFragment and the GuidedStepFragment.

And, in addition to that, these references might also help:

Teyam
  • 7,686
  • 3
  • 15
  • 22
0

This is due to the incompatibility of the Activity from the support library version of less than 17 with GuidedStepFragment from the support library "android.support.v17.leanback".

Use Activity from the "android.app.Activity":

import android.app.Activity;
import android.os.Bundle;
import android.support.v17.leanback.app.GuidedStepFragment;

public class YourActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (savedInstanceState == null) {
            GuidedStepFragment.addAsRoot(
                this, new YourGuidedStepFragment(), android.R.id.content
            );
        }
    }
}

Also use Theme.Leanback for your Activity:

<manifest...>
    <application...>
        <activity
            android:name=".YourActivity"
            android:theme="@style/Theme.Leanback"
        />
    </application>
</manifest>
Artilirium
  • 101
  • 3