Thursday, March 1, 2012

[android-developers] Error inflating class android.widget.TextView

I have this strange error reported only from Samsung GT-B7510 device running Android 2.2.2. I can not reproduce the error. Exception is thrown from activity's onCreate method when I try to set the content view. Here is the complete stack trace:

"java.lang.RuntimeException: Unable to start activity ComponentInfo{biz.binarysolutions.elevation/biz.binarysolutions.elevation.MainActivity}: android.view.InflateException: Binary XML file line #29: Error inflating class android.widget.TextView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2685)
    at android.app.ActivityThread.access$2300(ActivityThread.java:126)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:4633)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #29: Error inflating class android.widget.TextView
    at android.view.LayoutInflater.createView(LayoutInflater.java:513)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:200)
    at android.app.Activity.setContentView(Activity.java:1647)
    at biz.binarysolutions.elevation.MainActivity.onCreate(SourceFile:321)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2633)
    ... 11 more
Caused by: java.lang.reflect.InvocationTargetException
    at android.widget.TextView.<init>(TextView.java:346)
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    at android.view.LayoutInflater.createView(LayoutInflater.java:500)
    ... 25 more
Caused by: java.lang.IndexOutOfBoundsException
    at android.content.res.StringBlock.nativeGetString(Native Method)
    at android.content.res.StringBlock.get(StringBlock.java:82)
    at android.content.res.AssetManager.getPooledString(AssetManager.java:272)
    at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:728)
    at android.content.res.TypedArray.getText(TypedArray.java:96)
    at android.widget.TextView.<init>(TextView.java:583)
    ... 29 more
android.view.InflateException: Binary XML file line #29: Error inflating class android.widget.TextView
    at android.view.LayoutInflater.createView(LayoutInflater.java:513)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:200)
    at android.app.Activity.setContentView(Activity.java:1647)
    at biz.binarysolutions.elevation.MainActivity.onCreate(SourceFile:321)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2633)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2685)
    at android.app.ActivityThread.access$2300(ActivityThread.java:126)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:4633)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
    at android.widget.TextView.<init>(TextView.java:346)
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    at android.view.LayoutInflater.createView(LayoutInflater.java:500)
    ... 25 more
Caused by: java.lang.IndexOutOfBoundsException
    at android.content.res.StringBlock.nativeGetString(Native Method)
    at android.content.res.StringBlock.get(StringBlock.java:82)
    at android.content.res.AssetManager.getPooledString(AssetManager.java:272)
    at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:728)
    at android.content.res.TypedArray.getText(TypedArray.java:96)
    at android.widget.TextView.<init>(TextView.java:583)
    ... 29 more
java.lang.reflect.InvocationTargetException
    at android.widget.TextView.<init>(TextView.java:346)
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    at android.view.LayoutInflater.createView(LayoutInflater.java:500)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:200)
    at android.app.Activity.setContentView(Activity.java:1647)
    at biz.binarysolutions.elevation.MainActivity.onCreate(SourceFile:321)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2633)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2685)
    at android.app.ActivityThread.access$2300(ActivityThread.java:126)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:4633)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IndexOutOfBoundsException
    at android.content.res.StringBlock.nativeGetString(Native Method)
    at android.content.res.StringBlock.get(StringBlock.java:82)
    at android.content.res.AssetManager.getPooledString(AssetManager.java:272)
    at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:728)
    at android.content.res.TypedArray.getText(TypedArray.java:96)
    at android.widget.TextView.<init>(TextView.java:583)
    ... 29 more
java.lang.IndexOutOfBoundsException
    at android.content.res.StringBlock.nativeGetString(Native Method)
    at android.content.res.StringBlock.get(StringBlock.java:82)
    at android.content.res.AssetManager.getPooledString(AssetManager.java:272)
    at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:728)
    at android.content.res.TypedArray.getText(TypedArray.java:96)
    at android.widget.TextView.<init>(TextView.java:583)
    at android.widget.TextView.<init>(TextView.java:346)
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    at android.view.LayoutInflater.createView(LayoutInflater.java:500)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:200)
    at android.app.Activity.setContentView(Activity.java:1647)
    at biz.binarysolutions.elevation.MainActivity.onCreate(SourceFile:321)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2633)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2685)
    at android.app.ActivityThread.access$2300(ActivityThread.java:126)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:4633)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    at dalvik.system.NativeStart.main(Native Method)
"

And here is my layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/Black"
    >
   
    <LinearLayout
        android:layout_height="wrap_content"
        android:id="@+id/Data"
        android:layout_width="fill_parent"
        >
   
        <LinearLayout
            android:layout_height="wrap_content"
            android:id="@+id/Location"
            android:layout_width="fill_parent"
            android:layout_weight="1.0"
            >
           
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:id="@+id/LocationStrings"
                >
               
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/Lat"
                    android:id="@+id/LatString"
                />
               
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/Lon"
                    android:id="@+id/LonString"
                />
            </LinearLayout>
           
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/LocationValues"
                android:orientation="vertical"
                android:paddingLeft="5dip"
                >
               
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/LatValue"
                />
               
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/LonValue"
                />
            </LinearLayout>
        </LinearLayout>
       
        <LinearLayout
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:layout_weight="1.0"
            android:id="@+id/Elevation"
            >
           
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:id="@+id/ElevationStrings"
                >
               
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/EleGPS"
                    android:id="@+id/EleGpsString"
                />
               
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/EleAPI"
                    android:id="@+id/EleApiString"
                />
            </LinearLayout>
           
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:paddingLeft="5dip"
                android:id="@+id/ElevationValues"
                >
               
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/EleGpsValue"
                />
               
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/EleApiValue"
                />
            </LinearLayout>
        </LinearLayout>
       
        <LinearLayout
            android:layout_height="wrap_content"
            android:layout_weight="1.0"
            android:layout_width="fill_parent"
            android:id="@+id/CourseAndSpeed"
            >

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:id="@+id/CourseAndSpeedStrings"
                >
               
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/CourseString"
                    android:text="@string/Course"
                />
               
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/SpeedString"
                    android:text="@string/Speed"
                />
            </LinearLayout>
           
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingLeft="5dip"
                android:orientation="vertical"
                android:id="@+id/CourseAndSpeedValues"
                >
               
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/CourseValue"
                />
               
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/SpeedValue"
                />
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
   
    <LinearLayout
        android:id="@+id/Chart"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_weight="1.0"
    />

    <LinearLayout
        android:id="@+id/AdContainer"
        xmlns:admobsdk="http://schemas.android.com/apk/res/biz.binarysolutions.elevation"
        android:layout_height="48dp"
        android:layout_width="fill_parent"
        android:gravity="center"
        >
       
        <!--
        <com.adwhirl.AdWhirlLayout
            android:id="@+id/adwhirl_layout"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
        />
        -->
   
        <!--
        <com.admob.android.ads.AdView
            android:id="@+id/ad"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            admobsdk:backgroundColor="#000000"
            admobsdk:primaryTextColor="#FFFFFF"
            admobsdk:secondaryTextColor="#FFFFFF"
            admobsdk:keywords="@string/ad_keyword"
           
        />
        -->
       
    </LinearLayout>
</LinearLayout>

What can be done here?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment