GoogleTV InflateException

时间:2012-01-17 15:49:14

标签: java android google-tv

我正在尝试在Google TV上移植我的应用程序,但是一旦我开始,我的一个xml文件就出现了InflateException。

在我尝试运行该应用程序(标签或手机)的任何其他设备上,它的工作没有任何问题,但在GoogleTV上它给出了这一点。

修改 因为正如一些人在评论中所指出的那样,XML文件并不是真正清楚的,因为有些文章在评论中指出,这种情况并非如此。它似乎是在TextView周围的包含布局(见下面的代码)。

有没有人得过这个Excpetion?

我从堆栈跟踪中注意到,inflater有不同的实现,我可以猜测它可能不支持我使用的任何东西。

我还注意到堆栈跟踪的底部有:

Caused by: java.lang.reflect.InvocationTargetException

实际上对我来说它没有说什么,但也许有人在那里:)。

任何想法?

XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent" >

<include android:layout_alignParentTop="true"
    layout="@layout/sd_error"/>

<GridView
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_margin="0dip"
    android:cacheColorHint="@android:color/transparent"
    android:listSelector="@drawable/mxm_list_selector"
    android:drawSelectorOnTop="true"
    android:numColumns="2"
    android:padding="0dip"
    android:stretchMode="columnWidth"
    android:nextFocusDown="@+id/music_now_playing_container"/>

<ProgressBar
    android:id="@android:id/empty"
    style="@style/Widget.ProgressBar.Large.Music"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true" />

 </RelativeLayout>

@布局/ sd_error:

<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
     <ImageView
        android:id="@+id/sd_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:background="@drawable/ic_mp_sd_card"
        android:visibility="gone" />

    <TextView
        android:id="@+id/sd_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:padding="8dip"
        android:text="@string/sdcard_missing_message"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:visibility="gone" />

</merge>

日志:

01-17 10:06:05.794: E/AndroidRuntime(26441): FATAL EXCEPTION: main
01-17 10:06:05.794: E/AndroidRuntime(26441): android.view.InflateException: Binary XML file line #18: Error inflating class <unknown>
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.LayoutInflater.createView(LayoutInflater.java:596)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at com.android.internal.policy.impl.tv.TvLayoutInflater.onCreateView(TvLayoutInflater.java:50)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:644)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:783)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:720)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at com.designfuture.music.ui.fragment.mymusic.TrackBrowserFragment.onCreateView(TrackBrowserFragment.java:179)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:870)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1080)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:622)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1416)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:431)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:139)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.support.v4.view.ViewPager.populate(ViewPager.java:820)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1032)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.View.measure(View.java:10939)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.View.measure(View.java:10939)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4491)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:267)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.View.measure(View.java:10939)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4491)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:267)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.View.measure(View.java:10939)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:764)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:519)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.View.measure(View.java:10939)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4491)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1284)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:613)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:519)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.View.measure(View.java:10939)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4491)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:267)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.View.measure(View.java:10939)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4491)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:267)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.View.measure(View.java:10939)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4491)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:267)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at com.android.internal.policy.impl.tv.TvWindow$DecorView.onMeasure(TvWindow.java:1274)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.View.measure(View.java:10939)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.ViewRoot.performTraversals(ViewRoot.java:949)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.view.ViewRoot.handleMessage(ViewRoot.java:2048)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.os.Looper.loop(Looper.java:132)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at android.app.ActivityThread.main(ActivityThread.java:4083)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at java.lang.reflect.Method.invokeNative(Native Method)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at java.lang.reflect.Method.invoke(Method.java:491)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
01-17 10:06:05.794: E/AndroidRuntime(26441):    at dalvik.system.NativeStart.main(Native Method)
01-17 10:06:05.794: E/AndroidRuntime(26441): Caused by: java.lang.reflect.InvocationTargetException
01-17 10:06:05.794: E/AndroidRuntime(26441):    at java.lang.reflect.Constructor.constructNative(Nat

编辑已解决:

我终于找到了问题所以我会在这里发布它是什么。 我只在文件夹 res / drawable-xxx-finger / 中获得了此@drawable/ic_mp_sd_card这样的问题,所以这个问题与GoogleTV没有任何关系,但一般情况下与手机无关不支持触摸屏。

0 个答案:

没有答案