• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps android.view.InflateException for some devices (mostly Android 4.4)

Hello people!

For my android app I see quite a number of crashes with an android.view.InflateException. Unfortunately, it does not happen on my device or simulators and the error is telling me nothing. I am assuming it works for most of the devices, the error is mostly occuring in Android 4.x and rarely on 5. Could any of you help me? That would be great! It seems to happen when the users open up my preference activity. Here is the stacktrace:

java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2413)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
at android.app.ActivityThread.access$900(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invokeNative(Native Method:0)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method:0)
Caused by: android.view.InflateException:
at android.preference.GenericInflater.createItem(GenericInflater.java:397)
at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)
at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)
at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
at android.preference.GenericInflater.inflate(GenericInflater.java:326)
at android.preference.GenericInflater.inflate(GenericInflater.java:263)
at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)
at android.preference.PreferenceFragment.addPreferencesFromResource(PreferenceFragment.java:315)
at bloggersoft.sudokuoftheday.EinstellungenActivity$MyPreferenceFragment.onCreate(EinstellungenActivity.java:305)
at android.app.Fragment.performCreate(Fragment.java:1678)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:859)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
at android.app.BackStackRecord.run(BackStackRecord.java:684)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1453)
at android.app.Activity.performStart(Activity.java:5467)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2386)​
 
Hi. First your question is impossible to answer without seeing the code.
Second, have you tried running the app on a virtual device running Android 4.x?
 
Hi, first thanks for your answer.
Indeed I didnt have the correct Android version in my emulator, but now I can replicate it. However, the error still doesnt give me a clue unfortunately. Which code do you need? The java code for the activity is quite long (some billing stuff, etc.), but I guess the error seems to me in the xml anyways?
Best
Oliver
 
Need to see at least the code of class EinstellungenActivity.java, and its corresponding XML layout.

But really inflateException is usually a side effect of some other issue, which is the root cause of the problem. Are you sure that you're showing all of the stack trace?
 
Things to look out for are errors in the resources required by your app. It's likely that your app is trying to use something that isn't present in Android 4.x. Again, any such errors would be visible in your log output, but I don't see anything in the stuff you've shown.
 
I have to apologize. The code I posted was the full output from the developer console stacktrace and did not help me as well, upon testing it in the right emulator the error was shown: I forgot to set a default value for a MultiSelectList preference. This fixed it. Thanks for your help!
 
Back
Top Bottom