Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AxEmojiPopupLayout - Failed to instantiate one or more classes #38

Open
colorgold opened this issue Jan 4, 2023 · 0 comments
Open

AxEmojiPopupLayout - Failed to instantiate one or more classes #38

colorgold opened this issue Jan 4, 2023 · 0 comments

Comments

@colorgold
Copy link

I am unable to preview the design of my xml file on Android Studio. Here's how I have added it to my code:

<com.aghajari.emojiview.view.AXEmojiPopupLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/emojiLayout"
        android:layout_gravity="bottom"
        />

Here is the error that it shows:

The following classes could not be instantiated:
- com.aghajari.emojiview.view.AXEmojiPopupLayout (Open Class, Show Exception, Clear Cache)

 Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE.  If this is an unexpected error you can also try to build the project, then manually refresh the layout.

java.lang.IllegalArgumentException: The passed Context is not an Activity.
	at com.aghajari.emojiview.utils.Utils.asActivity(Utils.java:228)
	at com.aghajari.emojiview.view.AXEmojiPopupLayout$KeyboardHeightProvider.<init>(AXEmojiPopupLayout.java:269)
	at com.aghajari.emojiview.view.AXEmojiPopupLayout.initKeyboardHeightProvider(AXEmojiPopupLayout.java:73)
	at com.aghajari.emojiview.view.AXEmojiPopupLayout.<init>(AXEmojiPopupLayout.java:55)
	at com.aghajari.emojiview.view.AXEmojiPopupLayout.<init>(AXEmojiPopupLayout.java:49)
	at jdk.internal.reflect.GeneratedConstructorAccessor1780.newInstance(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:351)
	at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:200)
	at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:161)
	at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:294)
	at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:417)
	at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:428)
	at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:332)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
	at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1127)
	at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:505)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:359)
	at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:436)
	at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:121)
	at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:717)
	at com.android.tools.idea.rendering.RenderTask.lambda$inflate$9(RenderTask.java:873)
	at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$3.run(RenderExecutor.kt:192)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

I tried rebuilding the project and refreshing the layout, but it does not work. Please let me know if there's a way I can fix this.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant