- Google Android — это несложно
- Error inflating class — не могу отловить баг
- Error inflating class — не могу отловить баг
- android.view.InflateException: Binary XML file line #2: Error inflating class #73
- Comments
- ghost commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
- alex-soft-r commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
- alex-soft-r commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
- alex-soft-r commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
- alex-soft-r commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
- android.view.InflateException: Binary XML file line #2: Error inflating class #73
- Comments
- ghost commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
- alex-soft-r commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
- alex-soft-r commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
- alex-soft-r commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
- alex-soft-r commented Mar 7, 2015
- mikepenz commented Mar 7, 2015
Google Android — это несложно
Добро пожаловать на форум сайта
Error inflating class — не могу отловить баг
Error inflating class — не могу отловить баг
Сообщение blackdiamond » 26 мар 2013, 21:54
Уважаемые господа профи, помогите пож-ста с определением причины бага!
Кратко суть дела: запускаю приложение (игру) на реальном устройстве (телефоне, планшете) — все хорошо. На эмуляторе телефона — все хорошо, а вот на эмуляторе планшета 7 или 10.1 (эмулирую API8 и выше — без разницы) приложение не запускается и вылетает с ошибкой (об этом ниже).
Подумал, что это глюки эмулятора и выложил приложение на GooglePlay.
Несколько дней все было Ок, но вот сегодня увидел в консоли разработчика сбой (ANR) и лог ошибки такой же как был на эмуляторе планшетов при вылете приложения.
Поиск по Stack Overflow приводит к очен похожим багам, но до сути проблемы никто не дошел
(только в одном ответе есть совет установить в манифесте атрибут но у меня этот атрибут установлен и все-равно ошибка появляется)
Вот лог ошибки:
java.lang.RuntimeException: Unable to start activity ComponentInfo<тут_название_моего_пакета.GameActivity>: android.view.InflateException: Binary XML file line #1: Error inflating class
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:518)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
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:209)
at android.app.Activity.setContentView(Activity.java:1657)
at тут_название_моего_пакета.GameActivity.onCreate(GameActivity.java:65)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
. 11 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at android.view.LayoutInflater.createView(LayoutInflater.java:505)
. 21 more
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue
at android.content.res.Resources.loadDrawable(Resources.java:1681)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View. (View.java:1951)
at android.view.View. (View.java:1899)
at android.view.ViewGroup. (ViewGroup.java:286)
at android.widget.RelativeLayout. (RelativeLayout.java:173)
. 24 more
Вот разметка xml файла (game_layout), которая грузится в GameActivity в методе onCreate:
Источник
android.view.InflateException: Binary XML file line #2: Error inflating class #73
Comments
ghost commented Mar 7, 2015
Version 2.0 no-longer works for me, whereas version 1.0.2 worked normally:
Looks like there is an issue inflating R.layout.material_drawer_slider
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class
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.inflate(LayoutInflater.java:482)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at com.mikepenz.materialdrawer.Drawer.a(Drawer.java:743)
The text was updated successfully, but these errors were encountered:
mikepenz commented Mar 7, 2015
@jimok82 do you use the default layout implementation without any custom layout?
have you tried to clean your project?
alex-soft-r commented Mar 7, 2015
have this problem too
Process: com.s0l.social, PID: 18037
java.lang.RuntimeException: Unable to start activity ComponentInfo
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
at android.app.ActivityThread.access$800(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:626)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at com.mikepenz.materialdrawer.Drawer.build(Drawer.java:734)
at com.s0l.social.MainActivity.makeLeftMenu(MainActivity.java:272)
at com.s0l.social.MainActivity.onCreate(MainActivity.java:216)
at android.app.Activity.performCreate(Activity.java:5389)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2256)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
at android.app.ActivityThread.access$800(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:600)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at com.mikepenz.materialdrawer.Drawer.build(Drawer.java:734)
at com.s0l.social.MainActivity.makeLeftMenu(MainActivity.java:272)
at com.s0l.social.MainActivity.onCreate(MainActivity.java:216)
at android.app.Activity.performCreate(Activity.java:5389)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2256)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
at android.app.ActivityThread.access$800(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue
at android.content.res.Resources.loadDrawable(Resources.java:3012)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.view.View.(View.java:3694)
at android.view.ViewGroup.(ViewGroup.java:480)
at android.widget.LinearLayout.(LinearLayout.java:176)
at android.widget.LinearLayout.(LinearLayout.java:172)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:600)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at com.mikepenz.materialdrawer.Drawer.build(Drawer.java:734)
at com.s0l.social.MainActivity.makeLeftMenu(MainActivity.java:272)
at com.s0l.social.MainActivity.onCreate(MainActivity.java:216)
at android.app.Activity.performCreate(Activity.java:5389)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2256)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
at android.app.ActivityThread.access$800(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
mikepenz commented Mar 7, 2015
@alex-soft-r do you have any special drawer implementation?
have you cleaned your workspace?
alex-soft-r commented Mar 7, 2015
im found problem
in new layouts files u set «colors» like android:background=»?material_drawer_background»
and if we change «?» to «@color» all is good ( android:background=»@color/material_drawer_background»)
mikepenz commented Mar 7, 2015
@alex-soft-r @jimok82 so you both don’t use the provided theme?
alex-soft-r commented Mar 7, 2015
my theme is «parent=»Theme.AppCompat.Light.DarkActionBar»>»
mikepenz commented Mar 7, 2015
Yeah i see. If you use the provided theme (the MaterialDrawer.* themes) then it will work.
mikepenz commented Mar 7, 2015
@alex-soft-r @jimok82 if you don’t use the provided theme. or don’t want to use / don’t like to use you have to add following attributes to your style:
alex-soft-r commented Mar 7, 2015
@mikepenz — im confirm, all work 😉 thanks
mikepenz commented Mar 7, 2015
@alex-soft-r thanks for help. i’ve added a note about this to the README.md
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
android.view.InflateException: Binary XML file line #2: Error inflating class #73
Comments
ghost commented Mar 7, 2015
Version 2.0 no-longer works for me, whereas version 1.0.2 worked normally:
Looks like there is an issue inflating R.layout.material_drawer_slider
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class
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.inflate(LayoutInflater.java:482)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at com.mikepenz.materialdrawer.Drawer.a(Drawer.java:743)
The text was updated successfully, but these errors were encountered:
mikepenz commented Mar 7, 2015
@jimok82 do you use the default layout implementation without any custom layout?
have you tried to clean your project?
alex-soft-r commented Mar 7, 2015
have this problem too
Process: com.s0l.social, PID: 18037
java.lang.RuntimeException: Unable to start activity ComponentInfo
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
at android.app.ActivityThread.access$800(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:626)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at com.mikepenz.materialdrawer.Drawer.build(Drawer.java:734)
at com.s0l.social.MainActivity.makeLeftMenu(MainActivity.java:272)
at com.s0l.social.MainActivity.onCreate(MainActivity.java:216)
at android.app.Activity.performCreate(Activity.java:5389)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2256)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
at android.app.ActivityThread.access$800(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:600)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at com.mikepenz.materialdrawer.Drawer.build(Drawer.java:734)
at com.s0l.social.MainActivity.makeLeftMenu(MainActivity.java:272)
at com.s0l.social.MainActivity.onCreate(MainActivity.java:216)
at android.app.Activity.performCreate(Activity.java:5389)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2256)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
at android.app.ActivityThread.access$800(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue
at android.content.res.Resources.loadDrawable(Resources.java:3012)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.view.View.(View.java:3694)
at android.view.ViewGroup.(ViewGroup.java:480)
at android.widget.LinearLayout.(LinearLayout.java:176)
at android.widget.LinearLayout.(LinearLayout.java:172)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:600)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at com.mikepenz.materialdrawer.Drawer.build(Drawer.java:734)
at com.s0l.social.MainActivity.makeLeftMenu(MainActivity.java:272)
at com.s0l.social.MainActivity.onCreate(MainActivity.java:216)
at android.app.Activity.performCreate(Activity.java:5389)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2256)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
at android.app.ActivityThread.access$800(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
mikepenz commented Mar 7, 2015
@alex-soft-r do you have any special drawer implementation?
have you cleaned your workspace?
alex-soft-r commented Mar 7, 2015
im found problem
in new layouts files u set «colors» like android:background=»?material_drawer_background»
and if we change «?» to «@color» all is good ( android:background=»@color/material_drawer_background»)
mikepenz commented Mar 7, 2015
@alex-soft-r @jimok82 so you both don’t use the provided theme?
alex-soft-r commented Mar 7, 2015
my theme is «parent=»Theme.AppCompat.Light.DarkActionBar»>»
mikepenz commented Mar 7, 2015
Yeah i see. If you use the provided theme (the MaterialDrawer.* themes) then it will work.
mikepenz commented Mar 7, 2015
@alex-soft-r @jimok82 if you don’t use the provided theme. or don’t want to use / don’t like to use you have to add following attributes to your style:
alex-soft-r commented Mar 7, 2015
@mikepenz — im confirm, all work 😉 thanks
mikepenz commented Mar 7, 2015
@alex-soft-r thanks for help. i’ve added a note about this to the README.md
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник