Android/View/View$Onunhandledkeyeventlistener (Onmeasure Error)

android/view/view$onUnhandledKeyEventListener (onMeasure error)

I found the answer, but I'm not sure this is the best answer. But this fix all the issue.

The error could be because of a bug in the API 28.0.0-alpha3 which may mess around with the backward compatibility (I'm not completely sure about it yet).

build.gradle(Module: app) (before fix)-->

build.gradle(Module: app)

compileSdkVersion 28

targetSdkVersion 28

implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'

I fixed the error by reducing the API version to 27.1.1 and changing the compileSdkVersion, targetSdkVersion and implementation.

build.gradle(Module: app)(after fixing error) -->

build.gradle(Module: app)

To fix the error just change

compileSdkVersion 27

targetSdkVersion 27

implementation 'com.android.support:appcompat-v7:27.1.1'

And Re-build the Gradle. This will clear all the error and warning about the ActionBar and toolbar.

no error and working toolbar

android.view.View$OnUnhandledKeyEventListener

Make the changes in your build.gradle (app level) to downgrade to version 27 as below. Then sync and build project. Hopefully it will fix the issue..

compileSdkVersion 27

targetSdkVersion 27

implementation 'com.android.support:appcompat-v7:27.1.1'

Android Studio 3.5.3 show Design view empty but build is Successful

@MikeBottle, There might be a couple of things going on here. It could be because your activity doesn't have theme assigned.
Please check this:
Sample Image

Note: In the design view, when you click the eye icon, it will give you the options to show / hide the layout decorations. It includes the top and bottom status bars. Please check if that changes anything.

Also, make sure the activity has theme assigned.

Sample Image

For the reference, I also included the layout preview to demonstrate how it look when show layout decorations is not checked.

Fake missing layout attributes

You need to set the layout_width and layout_height in the View as a parameter.
The reason is:
The layout values are not reachable in your style.xml, but in your Layout (as the name implies.)

It should look like that in your Layout:

<View style="@style/Separator"
android:layout_width="fill_parent"
android:layout_height="w1dp" />

and in your styles.xml:

....
<style name="Separator">
<item name="android:layout_marginBottom">0dp</item>
<item name="android:layout_marginLeft">3dp</item>
<item name="android:layout_marginRight">3dp</item>
<item name="android:layout_marginTop">0dp</item>
<item name="android:background">#007788</item>
</style>

How to fix ClassNotFoundException when I change layout to invisible

You have the wrong import in your MainActivity import android.widget.GridLayout;.

You need to use import android.support.v7.widget.GridLayout because you are inflating support library version of GridLayout in your xml file.

Look at source of crash - Caused by: java.lang.ClassCastException: android.support.v7.widget.GridLayout cannot be cast to android.widget.GridLayout



Related Topics



Leave a reply



Submit