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

Exception in layout editor #1

Open
weirdgyn opened this issue Mar 16, 2020 · 4 comments
Open

Exception in layout editor #1

weirdgyn opened this issue Mar 16, 2020 · 4 comments

Comments

@weirdgyn
Copy link

weirdgyn commented Mar 16, 2020

When I try to use this component I always get this message in layout editor:

The following classes could not be instantiated:
- eo.view.signalstrength.SignalStrengthView (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.

This's the exception I got:

android.content.res.Resources$NotFoundException: Resource ID #0x7f090000
	at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:237)
	at android.content.res.Resources.getFraction(Resources.java:776)
	at eo.view.signalstrength.SignalStrengthDrawable.<init>(SignalStrengthDrawable.kt:29)
	at eo.view.signalstrength.SignalStrengthView.<init>(SignalStrengthView.kt:56)
	at eo.view.signalstrength.SignalStrengthView.<init>(SignalStrengthView.kt:12)
	at eo.view.signalstrength.SignalStrengthView.<init>(SignalStrengthView.kt)
	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:404)
	at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:187)
	at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:145)
	at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:309)
	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:961)
	at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1123)
	at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1097)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:501)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:328)
	at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:396)
	at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:209)
	at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:608)
	at com.android.tools.idea.rendering.RenderTask.lambda$inflate$6(RenderTask.java:734)
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

this's the xml code:

<eo.view.signalstrength.SignalStrengthView android:id="@+id/gcs_signal_level" android:layout_width="50dp" android:layout_height="50dp" app:layout_constraintEnd_toStartOf="@+id/gcs_battery_level" app:layout_constraintTop_toTopOf="parent" app:signalStrengthColor="?colorAccent" app:signalStrengthLevel="50" app:signalStrengthTheme="rounded" />

BTW I'm using battery-meter-view in the same project and it works fine.
The sample application is working.

@Elswah
Copy link

Elswah commented Dec 7, 2023

how did you solve it @weirdgyn

@weirdgyn
Copy link
Author

weirdgyn commented Dec 7, 2023

how did you solve it @weirdgyn

hi @Elswah .... I designed one on my own.

@Elswah
Copy link

Elswah commented Dec 11, 2023

@weirdgyn could you share the custom view with me

@weirdgyn
Copy link
Author

I have some problem in copy pasting code here ... and the repository of the project where I'm using it is private.
I'm sharing this .java files trough google drive:

https://drive.google.com/file/d/1017Kv8G9y_ysMIIVfsWQlhAYfRAUmIC-/view?usp=sharing

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

2 participants