It always shows me this error in the massages:
java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener
My project is literally Hello, World! and I just open Android Studio and click on the empty activity and then wait for the build to finish, but it doesn't render the app.
I reinstalled Android Studio and JDK 10. But it doesn't work. The project shows fine in virtual device and I can even edit Hello, World! to any string, but in the XML view, it just shows a white screen:
.
Here is the stack trace:
java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener
at org.jetbrains.android.uipreview.ModuleClassLoader.load(ModuleClassLoader.java:180)
at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:61)
at org.jetbrains.android.uipreview.ModuleClassLoader.findClass(ModuleClassLoader.java:118)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.jetbrains.android.uipreview.ModuleClassLoader.loadClass(ModuleClassLoader.java:213)
at android.support.v7.widget.ActionBarContainer.<init>(ActionBarContainer.java:62)
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:481)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:264)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:222)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:209)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:337)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:348)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:248)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:863)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.android.layoutlib.bridge.bars.BridgeActionBar.<init>(BridgeActionBar.java:89)
at com.android.layoutlib.bridge.bars.AppCompatActionBar.<init>(AppCompatActionBar.java:68)
at com.android.layoutlib.bridge.impl.Layout.createActionBar(Layout.java:277)
at com.android.layoutlib.bridge.impl.Layout.<init>(Layout.java:161)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:288)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:384)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:544)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$3(RenderTask.java:678)
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 Studio doesn’t start after installing version 4.2 Studio tries to import previous.vmoptions and sanitize them to work with the garbage collector used by JDK 11. If that process fails, the IDE may not start for certain users who set custom VM options in the.vmoptions file.
JVMTI error: UNKNOWN_JVMTI_ERROR To work around this issue in Android Studio 3.5, click Run to re-deploy your app and see your changes. Note: This issue ( #135172147) is fixed in Android Studio 3.6 Canary 6 and higher.
If not, you can use a terminal to navigate to the Android Studio installation directory and execute the bin/lldb/bin/LLDBFrontend --version command line to learn which libraries are missing. Typically, the missing library is ncurses5 as some recent Linux distributions have already upgraded to ncurses6.
You may experience "Recording failed to stop" errors in the Android Studio CPU Profiler when you select the Sample Java Methods or Trace Java Methods configurations. These are often timeout errors, especially if you see the following error message in the idea.log file:
Yes, it happens. You can fix it easily.
The first method:
Open build.gradle (Module: app) under Gradle Scripts and change version alpha3 to alpha1 and Sync now
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
The second method:
Open file style.xml under res → values → style.xml and change this line:
style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
Put Base.
before Theme.AppCompat.Light.DarkActionBar like
style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
The issue you faced was due to using an alpha version of the AppCompat library. Use the stable version to get rid of this issue now and in the future.
android.support
stable versionCurrently 27.1.1 is the latest version of AppComactV7. You can see the Maven Repo link to find out the latest.
final def SUPPORT_VERSION = "27.1.1"
implementation "com.android.support:appcompat-v7:$SUPPORT_VERSION"
implementation "com.android.support:design:$SUPPORT_VERSION" // use only if already using
I use definitions to have the same version for all support versions. Also ignore the design library if you are not already using it.
compileSdkVersion
and targetSdkVersion
(optional)You also need to downgrade your compileSdkVersion
and targetSdkVersion
to remove some Gradle warnings.
So use the below versions.
compileSdkVersion 27
targetSdkVersion 27
Read about Alpha and Beta releases.
Go to
Gradle scripts>build.gradle(module app) > change 'com.android.support:appcompat-v7:28.0.0-alpha3' to 'com.android.support:appcompat-v7:28.0.0-alpha1'
You may have something other than alpha3 after "-v7:28.0.0-" whatever it is just change it to alpha1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With