android.view.InflateException: строка двоичного файла XML - как избежать
У меня проблема с надуванием, я не знаю, как ее решить, потому что это странная проблема. Я попал в аварию BaseFragment
класс в строке 60 для устройств samsung и huawei (huawei gra_l09). Код выглядит следующим образом:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
int contentView = onFragmentContentView();
if(contentView == 0)
throw new IllegalArgumentException("onFragmentContentView must be not equal 0");
View layout = inflater.inflate(contentView, container, false); //!!line 60
ButterKnife.inject(this, layout);
onCreateFragmentView(layout, container, savedInstanceState);
return layout;
}
Я не уверен, что тема является причиной? Я использовал Theme.AppCompat.Light.
Неустранимое исключение: android.view.InflateException: строка двоичного файла XML
2: Ошибка надувания класса
at android.view.LayoutInflater.createView(LayoutInflater.java:633) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:892) at android.view.LayoutInflater.rInflate(LayoutInflater.java:802) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at com.vyda.stream.fragments.BaseFragment.onCreateView(BaseFragment.java:60) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:763) at java.lang.reflect.Constructor.newInstance(Constructor.java) at java.lang.reflect.Constructor.newInstance(Constructor.java:288) at android.view.LayoutInflater.createView(LayoutInflater.java:607) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:892) at android.view.LayoutInflater.rInflate(LayoutInflater.java:802) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at com.vyda.stream.fragments.BaseFragment.onCreateView(BaseFragment.java:60) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:977) > byte allocation with 3357954 free bytes and 3MB until OOM at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:763) at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java) at android.graphics.BitmapFactory.nativeDecodeAsset(BitmapFactory.java) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609) at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444) at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:988) at android.content.res.Resources.loadDrawableForCookie(Resources.java:2480) at android.content.res.Resources.loadDrawable(Resources.java:2387) at android.content.res.TypedArray.getDrawable(TypedArray.java:749) at android.view.View.<init>(View.java:3754) at android.view.ViewGroup.<init>(ViewGroup.java:498) at android.widget.RelativeLayout.<init>(RelativeLayout.java:249) at android.widget.RelativeLayout.<init>(RelativeLayout.java:245) at android.widget.RelativeLayout.<init>(RelativeLayout.java:241) at java.lang.reflect.Constructor.newInstance(Constructor.java) at java.lang.reflect.Constructor.newInstance(Constructor.java:288) at android.view.LayoutInflater.createView(LayoutInflater.java:607) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:892) at android.view.LayoutInflater.rInflate(LayoutInflater.java:802) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at com.vyda.stream.fragments.BaseFragment.onCreateView(BaseFragment.java:60) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:977) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:763)
[Правка]: Весь код класса: http://pastebin.com/nSCpY35Y
2 ответа
Добавь это:
android:largeHeap="true"
в вашем файле манифеста, чтобы избежать ошибки OOM.
У вас OOM (ошибка нехватки памяти) byte allocation with 3357954 free bytes and 3MB until OOM
проверьте размер ваших изображений.