KeyboardView error in xml - java

Keyboard View in my Layout issues Exception raised during rendering: Binary XML file line #-1: Error inflating class .
in xml:
<RelativeLayout>
///
<android.inputmethodservice.KeyboardView
android:id="#+id/keyboardview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:visibility="gone"
/>
///
</RelativeLayout>
Details:
java.lang.UnsupportedOperationException: Unsupported Service: audio
at com.android.layoutlib.bridge.android.BridgeContext.getSystemService(BridgeContext.java:602)
at android.inputmethodservice.KeyboardView.<init>(KeyboardView.java:359)
at android.inputmethodservice.KeyboardView.<init>(KeyboardView.java:263)
at android.inputmethodservice.KeyboardView.<init>(KeyboardView.java:259)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:222)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$70(RenderTask.java:659)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
The Changes of API versions in Editor don't help.
Thank you in advance.

Related

Error inflating Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView

Running app on Android version 7.1.1 device. Was working perfectly then suddenly I got this inflation exception error.
XML file:
<com.google.android.material.textview.MaterialTextView
android:id="#+id/titleLogin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:paddingStart="20dp"
android:paddingTop="20dp"
android:paddingBottom="10dp"
android:text="Login"
android:textColor="#color/black"
android:textSize="34sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0"
app:layout_constraintWidth_percent=".8" />
Logcat:
Caused by: android.view.InflateException: Binary XML file line #53: Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView
Caused by: android.view.InflateException: Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView
Caused by: java.lang.reflect.InvocationTargetException
I tried changing MaterialTextView to TextView, did not work.
As I don't have any drawable or layouts imported I don't know why the problem is there. As I said, was working fine one moment and crashed the next.
Does the same with a button as well...
Stack trace:
2022-10-29 21:16:00.512 12386-12386/com.poweredbyralph.southernlines E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.poweredbyralph.southernlines, PID: 12386
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.poweredbyralph.southernlines/com.poweredbyralph.southernlines.LoginActivity}: android.view.InflateException: Binary XML file line #53: Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2798)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2863)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6410)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945)
Caused by: android.view.InflateException: Binary XML file line #53: Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView
Caused by: android.view.InflateException: Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:710)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
at com.poweredbyralph.southernlines.LoginActivity.onCreate(LoginActivity.java:39)
at android.app.Activity.performCreate(Activity.java:6681)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2863)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6410)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=56; index=930
at android.content.res.StringBlock.get(StringBlock.java:65)
at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:458)
at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:1218)
at android.content.res.TypedArray.getText(TypedArray.java:168)
at android.widget.TextView.<init>(TextView.java:1028)
2022-10-29 21:16:00.512 12386-12386/com.poweredbyralph.southernlines E/AndroidRuntime: at android.widget.TextView.<init>(TextView.java:731)
at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:108)
at com.google.android.material.textview.MaterialTextView.<init>(MaterialTextView.java:88)
at com.google.android.material.textview.MaterialTextView.<init>(MaterialTextView.java:83)
... 31 more
#CommonsWare, this "The error seems to be complaining about a string resource" actually gave me an idea. I changed my TextViews and Buttons to use strings from the strings file rather than adding them directly.
android:text="Login"
TO:
android:text="#string/login"
Problem solved!!
Thanks for pointing String resource out:)

Android widget rendering error

How can I fix it? I created the project and bam, instant error without touching any code. Any fixing method is appreciated. I have tried sync, clean code, clean cache. None of these methods work.
enter code here java.lang.NullPointerException
at android.content.res.Resources_Delegate.getValue(Resources_Delegate.java:788)
at android.content.res.Resources.getValue(Resources.java:1286)
at android.support.v4.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:212)
at android.support.v4.content.res.ResourcesCompat.getFont(ResourcesCompat.java:206)
at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119)
at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208)
at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:152)
at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:81)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:71)
at sun.reflect.GeneratedConstructorAccessor471.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:475)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:250)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:213)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadClass(LayoutlibCallbackImpl.java:193)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:333)
at android.view.BridgeInflater.onCreateView(BridgeInflater.java:152)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:222)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at com.android.layoutlib.bridge.bars.CustomBar.<init>(CustomBar.java:95)
at com.android.layoutlib.bridge.bars.StatusBar.<init>(StatusBar.java:67)
at com.android.layoutlib.bridge.impl.Layout.createStatusBar(Layout.java:224)
at com.android.layoutlib.bridge.impl.Layout.<init>(Layout.java:146)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:301)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:368)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:567)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:549)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:863)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:549)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$1(RenderTask.java:680)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

android.support.v7.widget.AppCompatTextView cannot be instantiated

I'm facing this problem in the layout.
PS: I don't face any problem while running, but I want to know what this problem is and how I can resolve it.
The problem is in the layout editor.
ScreenShot of the error
java.lang.NullPointerException
at android.content.res.Resources_Delegate.getValue(Resources_Delegate.java:788)
at android.content.res.Resources.getValue(Resources.java:1286)
at android.support.v4.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:212)
at android.support.v4.content.res.ResourcesCompat.getFont(ResourcesCompat.java:206)
at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119)
at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208)
at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:152)
at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:81)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:71)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:475)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:250)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:213)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadClass(LayoutlibCallbackImpl.java:193)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:333)
at android.view.BridgeInflater.onCreateView(BridgeInflater.java:152)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:222)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at com.android.layoutlib.bridge.bars.CustomBar.<init>(CustomBar.java:95)
at com.android.layoutlib.bridge.bars.StatusBar.<init>(StatusBar.java:67)
at com.android.layoutlib.bridge.impl.Layout.createStatusBar(Layout.java:224)
at com.android.layoutlib.bridge.impl.Layout.<init>(Layout.java:146)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:301)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:368)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:567)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:549)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:863)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:549)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$1(RenderTask.java:680)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
I also had this error and I corrected it by modifying the parent theme in res/values/styles.xml :

Java android crash when add android.support.design.widget.NavigationView

When I add this code in activity_main.xml :
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:menu="#menu/activity_main_drawer" />
My app is crashed . Into build gradle, I added a in dependencies :
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
When I remove a android.support.design.widget.NavigationView it is working
This is a log :
Process: com.smok.maps, PID: 16311
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.smok.maps/com.smok.maps.MainActivity}: android.view.InflateException: Binary XML file line #431: Binary XML file line #431: Error inflating class android.support.design.widget.NavigationView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.view.InflateException: Binary XML file line #431: Binary XML file line #431: Error inflating class android.support.design.widget.NavigationView
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:474)
at android.app.Activity.setContentView(Activity.java:2387)
at com.smok.maps.MainActivity.onCreate(MainActivity.java:285)
at android.app.Activity.performCreate(Activity.java:6876)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)?
at android.app.ActivityThread.access$1100(ActivityThread.java:221)?
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)?
at android.os.Handler.dispatchMessage(Handler.java:102)?
at android.os.Looper.loop(Looper.java:158)?
at android.app.ActivityThread.main(ActivityThread.java:7224)?
at java.lang.reflect.Method.invoke(Native Method)?
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)?
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)?
Caused by: android.view.InflateException: Binary XML file line #431: Error inflating class android.support.design.widget.NavigationView
at android.view.LayoutInflater.createView(LayoutInflater.java:657)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)?
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:474)?
at android.app.Activity.setContentView(Activity.java:2387)?
at com.smok.maps.MainActivity.onCreate(MainActivity.java:285)?
at android.app.Activity.performCreate(Activity.java:6876)?
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)?
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)?
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)?
at android.app.ActivityThread.access$1100(ActivityThread.java:221)?
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)?
at android.os.Handler.dispatchMessage(Handler.java:102)?
at android.os.Looper.loop(Looper.java:158)?
at android.app.ActivityThread.main(ActivityThread.java:7224)?
at java.lang.reflect.Method.invoke(Native Method)?
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)?
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)?
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:631)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)?
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)?
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)?
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:527)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)?
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:474)?
at android.app.Activity.setContentView(Activity.java:2387)?
at com.smok.maps.MainActivity.onCreate(MainActivity.java:285)?
at android.app.Activity.performCreate(Activity.java:6876)?
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)?
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)?
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)?
at android.app.ActivityThread.access$1100(ActivityThread.java:221)?
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)?
at android.os.Handler.dispatchMessage(Handler.java:102)?
at android.os.Looper.loop(Looper.java:158)?
at android.app.ActivityThread.main(ActivityThread.java:7224)?
at java.lang.reflect.Method.invoke(Native Method)?
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)?
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)?
Caused by: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class android.support.design.internal.NavigationMenuView
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.support.design.internal.NavigationMenuPresenter.getMenuView(NavigationMenuPresenter.java:98)
at android.support.design.widget.NavigationView.<init>(NavigationView.java:161)
at android.support.design.widget.NavigationView.<init>(NavigationView.java:92)
at java.lang.reflect.Constructor.newInstance(Native Method)?
at android.view.LayoutInflater.createView(LayoutInflater.java:631)?
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)?
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)?
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)?
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:527)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)?
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:474)?
at android.app.Activity.setContentView(Activity.java:2387)?
at com.smok.maps.MainActivity.onCreate(MainActivity.java:285)?
at android.app.Activity.performCreate(Activity.java:6876)?
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)?
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)?
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)?
at android.app.ActivityThread.access$1100(ActivityThread.java:221)?
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)?
at android.os.Handler.dispatchMessage(Handler.java:102)?
at android.os.Looper.loop(Looper.java:158)?
at android.app.ActivityThread.main(ActivityThread.java:7224)?
at java.lang.reflect.Method.invoke(Native Method)?
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)?
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)?
Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.design.internal.NavigationMenuView
at android.view.LayoutInflater.createView(LayoutInflater.java:657)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)?
at android.support.design.internal.NavigationMenuPresenter.getMenuView(NavigationMenuPresenter.java:98)?
at android.support.design.widget.NavigationView.<init>(NavigationView.java:161)?
at android.support.design.widget.NavigationView.<init>(NavigationView.java:92)?
at java.lang.reflect.Constructor.newInstance(Native Method)?
at android.view.LayoutInflater.createView(LayoutInflater.java:631)?
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)?
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)?
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)?
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:527)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)?
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:474)?
at android.app.Activity.setContentView(Activity.java:2387)?
at com.smok.maps.MainActivity.onCreate(MainActivity.java:285)?
at android.app.Activity.performCreate(Activity.java:6876)?
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)?
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)?
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)?
at android.app.ActivityThread.access$1100(ActivityThread.java:221)?
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)?
at android.os.Handler.dispatchMessage(Handler.java:102)?
at android.os.Looper.loop(Looper.java:158)?
at android.app.ActivityThread.main(ActivityThread.java:7224)?
at java.lang.reflect.Method.invoke(Native Method)?
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)?
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)?
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:631)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)?
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)?
at android.support.design.internal.NavigationMenuPresenter.getMenuView(NavigationMenuPresenter.java:98)?
at android.support.design.widget.NavigationView.<init>(NavigationView.java:161)?
at android.support.design.widget.NavigationView.<init>(NavigationView.java:92)?
at java.lang.reflect.Constructor.newInstance(Native Method)?
at android.view.LayoutInflater.createView(LayoutInflater.java:631)?
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)?
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)?
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)?
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:527)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)?
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)?
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:474)?
at android.app.Activity.setContentView(Activity.java:2387)?
at com.smok.maps.MainActivity.onCreate(MainActivity.java:285)?
at android.app.Activity.performCreate(Activity.java:6876)?
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)?
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)?
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)?
at android.app.ActivityThread.access$1100(ActivityThread.java:221)?
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)?
at android.os.Handler.dispatchMessage(Handler.java:102)?
at android.os.Looper.loop(Looper.java:158)?
at android.app.ActivityThread.main(ActivityThread.java:7224)?
at java.lang.reflect.Method.invoke(Native Method)?
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)?
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)?
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7f0100b8 a=-1}
at android.content.res.TypedArray.getDrawable(TypedArray.java:883)
at android.widget.AbsListView.<init>(AbsListView.java:1168)
at android.widget.ListView.<init>(ListView.java:
nav_header:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="#dimen/nav_header_height"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:theme="#style/ThemeOverlay.AppCompat.Dark" android:orientation="vertical"
android:gravity="bottom">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="#dimen/nav_header_vertical_spacing"
android:id="#+id/imageView" />
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="#dimen/nav_header_vertical_spacing"
android:text="Andy Point"
android:textAppearance="#style/TextAppearance.AppCompat.Body1" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="andypoint#androidtutorialpoint.com"
android:id="#+id/textView" />
</LinearLayout>
According to your error its pretty much clear that it has failed to inflate navigation menu. Please provide the #menu/activity_main_drawer file. And recheck it for external Strings or drawables and closed tags.
Well then you should use
<menu xmlns:android="http://schemas.android.com/apk/res/android">
instead of
<menu xmlns:android="schemas.android.com/apk/res/android">
and remove ; after that.
This is a problem of layout_gravity at line number 431 Please try to use layout_gravity = left
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:fitsSystemWindows="true" />

Android studio. Rendering problems. The following classes could not be found

When I try to look at my layout file I take this error:
Error
The following classes could not be found: - android.support.v7.widget.RecyclerView
I know there are many same questions in stackoverflow, but I didn't find solution for my problem. Full text of error is below. I use buildToolsVersion 23.0.2 and support library - 23.2.0. If I try to see how looks layout file in API version 22 or 23 it works right, but if API version is 21 or less I take this error.
Here is full text of error:
java.lang.UnsupportedOperationException: Unsupported Service: accessibility
at com.android.layoutlib.bridge.android.BridgeContext.getSystemService(BridgeContext.java:463)
at android.support.v7.widget.RecyclerView.<init>(RecyclerView.java:475)
at android.support.v7.widget.RecyclerView.<init>(RecyclerView.java:450)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:458)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:170)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:103)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:168)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:132)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:400)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:510)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:498)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:888)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:498)
at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:72)
at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:610)
at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:607)
at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:362)
at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:607)
at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:629)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:652)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:80)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:594)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:152)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:452)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:137)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:589)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:351)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Categories