0

After I updated my Android app yesterday, I'm getting this strange error only from some Samsung Galaxy Note II. I have some Note II devices and I couldn't replicate the issue on my own.

(Line 97 is the line that starts with the tag)

I am sure my class is extending the v4.fragment and FragmentActivity because it works on every devices I have tested it on. But I still get these crash reports and I have no idea how to go about fixing the issues.

Any ideas?

Java.lang.RuntimeException: Unable to start activity ComponentInfo{com.zyz.mobile/com.zyz.mobile.jade.JadeActivity}: android.view.InflateException: Binary XML file line #97: Error inflating class fragment at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2362) at android.app.ActivityThread.access$700(ActivityThread.java:168) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1329) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5493) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1209) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025) at dalvik.system.NativeStart.main(Native Method) Caused by: android.view.InflateException: Binary XML file line #97: Error inflating class fragment at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719) at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) at android.view.LayoutInflater.inflate(LayoutInflater.java:498) at android.view.LayoutInflater.inflate(LayoutInflater.java:398) at android.view.LayoutInflater.inflate(LayoutInflater.java:354) at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:361) at android.app.Activity.setContentView(Activity.java:1956) at com.zyz.mobile.jade.JadeActivity.onCreate(Unknown Source) at android.app.Activity.performCreate(Activity.java:5372) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270) ... 11 more Caused by: java.lang.NullPointerException at com.zyz.mobile.jade.BookshelfFragment.a(Unknown Source) at android.support.v4.app.p.a(Unknown Source) at android.support.v4.app.p.b(Unknown Source) at android.support.v4.app.p.a(Unknown Source) at android.support.v4.app.h.onCreateView(Unknown Source) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691) ... 21 more

The XML

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:paddingTop="20dp"
        >

    <com.zyz.mobile.widget.MyButton
            android:id="@+id/bookshelf_help"
            android:layout_height="match_parent"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:background="@drawable/jade_button"
            android:textColor="@color/white"
            android:text="@string/help"
            android:textSize="20sp"
            android:layout_margin="1dp"
            android:gravity="bottom|left"
            />

    <com.zyz.mobile.widget.MyButton
            android:id="@+id/bookshelf_option"
            android:layout_height="match_parent"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:background="@drawable/jade_button"
            android:textColor="@color/white"
            android:text="@string/option"
            android:textSize="20sp"
            android:layout_margin="1dp"
            android:gravity="bottom|left"
            />

    <com.zyz.mobile.widget.MyButton
            android:id="@+id/bookshelf_open"
            android:layout_height="match_parent"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:background="@drawable/jade_button"
            android:textColor="@color/white"
            android:text="@string/open_book"
            android:textSize="20sp"
            android:layout_margin="1dp"
            android:gravity="bottom|left"
            />

</LinearLayout>
<com.zyz.mobile.widget.MyTextView
        android:id="@+id/history_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/history_title"
        android:textColor="@color/black"
        android:textSize="20sp"
        android:background="@color/grey"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        android:paddingLeft="10dp"
        />

<fragment
        class="com.zyz.mobile.jade.BookshelfFragment"
        android:id="@+id/bookshelf_fragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

1 Answer 1

1

If you look in the stack trace you can see the issue is caused by a null pointer exception.

Caused by: java.lang.NullPointerException at com.zyz.mobile.jade.BookshelfFragment.a(Unknown Source)

Is this a library or something you wrote? If you get the source, you could put a breakpoint there and see exactly what the problem is.

Edit: Due to the method named 'a' I am assuming this is a stack trace reported from Google Play on a build that has ProGuard. Please read about debugging obfuscated code traces here.

Sign up to request clarification or add additional context in comments.

5 Comments

That's my own Fragment. And I have no idea what is the 'a' variable that it is referencing to. I'll try to debug in that direction. Thanks.
Is the stack trace from a release build that has ProGuard? It's likely that is your problem.
I see. Then I think it's better if I don't run ProGuard then, since it's an open source application. Thanks.
Yes, it's unlikely that you'll need ProGuard for an open source application. You probably won't know for a while, but if this has helped, please accept the answer.
Omg! Thanks for the link to how to debug obfuscated code. I was able to reproduce this problem on my phone! now I can debug it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.