2

I'm getting this crash report from a few users. They are using Samsung SPH-M840 Android version 4.1. The layout I am inflating is a simple FrameLayout with a fragment tag inside it. I am using actionbar-compat.

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.customprogrammingsolutions.ShabbosAlarm\/com.cpsolutions.alarmbase.alarm.AlarmMainActivity}: android.view.InflateException: Binary XML file line #30: Error inflating class com.android.internal.widget.ActionBarView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2062)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2087)
    at android.app.ActivityThread.access$600(ActivityThread.java:133)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1198)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4777)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:998)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:765)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class com.android.internal.widget.ActionBarView
    at android.view.LayoutInflater.createView(LayoutInflater.java:619)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:752)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:760)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
    at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3298)
    at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3358)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:314)
    at android.app.Activity.setContentView(Activity.java:1901)
    at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:208)
    at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:111)
    at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:76)
    at com.cpsolutions.alarmbase.alarm.AlarmMainActivity.onCreate(AlarmMainActivity.java:57)
    at android.app.Activity.performCreate(Activity.java:5042)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2026)
    ... 11 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
    at android.view.LayoutInflater.createView(LayoutInflater.java:593)
    ... 28 more
Caused by: android.view.InflateException: Binary XML file line #36: Error inflating class android.widget.TextView
    at android.view.LayoutInflater.createView(LayoutInflater.java:619)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:666)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:752)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:760)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
    at com.android.internal.widget.ActionBarView.initTitle(ActionBarView.java:834)
    at com.android.internal.widget.ActionBarView.setDisplayOptions(ActionBarView.java:631)
    at com.android.internal.widget.ActionBarView.<init>(ActionBarView.java:265)
    ... 31 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
    at android.view.LayoutInflater.createView(LayoutInflater.java:593)
    ... 41 more
Caused by: java.lang.NullPointerException
    at android.server.BluetoothPanProfileHandler.createNewTetheringAddressLocked(BluetoothPanProfileHandler.java:332)
    at android.text.method.SingleLineTransformationMethod.<init>(SingleLineTransformationMethod.java:33)
    at android.text.method.SingleLineTransformationMethod.getInstance(SingleLineTransformationMethod.java:57)
    at android.widget.TextView.applySingleLine(TextView.java:7147)
    at android.widget.TextView.<init>(TextView.java:1208)
    at android.widget.TextView.<init>(TextView.java:606)
    ... 44 more

EDIT: Here's the xml, and onCreate of AlarmMainActivity:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <fragment class="com.cpsolutions.alarmbase.alarm.AlarmListFragment"
          android:id="@+id/alarm_list_frag"
          android:layout_width="match_parent"
          android:layout_height="match_parent"/>
</FrameLayout>

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    alarmFrag = (AlarmListFragment) getSupportFragmentManager().findFragmentById(R.id.alarm_list_frag);
    preferenceFrag = (AlarmPreferenceFragment) getSupportFragmentManager().findFragmentById(R.id.preference_list_frag);
    if(preferenceFrag != null) {
        isTwoPane = true;
    }
}
Eliezer
  • 7,209
  • 12
  • 56
  • 103

2 Answers2

0

You have a NullPointerException at

android.server.BluetoothPanProfileHandler.createNewTetheringAddressLocked(BluetoothPanProfileHandler.java:332)

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
0

There is an issue with the layout file used in:

com.cpsolutions.alarmbase.alarm.AlarmMainActivity.java

At line 57 there will be a setContentView with the argument R.layout.{insert name here}

Go to res/layout/{insert name here}.xml and fix the issue.

If you need help, post the XML file here.


EDIT:

The error is because it cannot inflate the ActionBarView. Please post the class declaration. (what it inherits or extends)

  • If you read further down the trace, you can see that it has nothing to do with my XML. The exception is getting thrown when an internal `ActionBarView` is being instantiated, with the specific exception being a NPE thrown from the `BluetoothPanProfileHandler.createNewTetheringAddressLocked` method. – Eliezer Feb 09 '14 at 18:26
  • The exception is somehow caused by a `singleLine="true"` –  Feb 10 '14 at 06:55
  • That is just an unfortunate side-effect –  Feb 10 '14 at 06:56
  • I'm just a little confused as to why a TextView would be calling anything from `BluetoothPanProfileHandler`. In any case, my layout is literally a `FrameLayout` with a `Fragment`. Nothing that could possibly cause an `InflateException`. In fact, 99.99% of the time this never happens. I only get crash reports about it sporadically. – Eliezer Feb 10 '14 at 07:54
  • Please post the XML file and AlarmMainActivity.java –  Feb 10 '14 at 08:38
  • I've posted them in my question. AlarmMainActivity is too long to post, so I just included onCreate(). – Eliezer Feb 10 '14 at 22:02