For some reason on the project I am working on in Android Studio the XML graphic editor has stopped showing me the picture of the screen layout. The app itself works fine and the layout woks fine on my device, but I don't have a picture of it on my computer screen in the editor.
The editor shows a error Rendering Problem - Exception raised during rendering
in the details it shows me a stack trace of a java.lang.NullPointerException, and it tip is to try and refresh the layout, but that doesn't work. I tried to refresh, to rebuild, and every other kind of refresh possible but nothing works. I checked other projects that I had worked on and thy where OK the graphics was fine, but not on my current project. So I need help finding the problem.
java.lang.NullPointerException
at android.graphics.BidiRenderer.getScriptFont(BidiRenderer.java:290)
at android.graphics.BidiRenderer.getScriptRuns(BidiRenderer.java:280)
at android.graphics.BidiRenderer.renderText(BidiRenderer.java:133)
at android.graphics.BidiRenderer.renderText(BidiRenderer.java:108)
at android.graphics.Paint_Delegate.measureText(Paint_Delegate.java:1310)
at android.graphics.Paint_Delegate.nGetTextAdvances(Paint_Delegate.java:972)
at android.graphics.Paint_Delegate.nGetRunAdvance(Paint_Delegate.java:1147)
at android.graphics.Paint.nGetRunAdvance(Paint.java)
at android.graphics.Paint.getRunAdvance(Paint.java:2729)
at android.text.TextLine.getRunAdvance(TextLine.java:729)
at android.text.TextLine.handleText(TextLine.java:778)
at android.text.TextLine.handleRun(TextLine.java:1018)
at android.text.TextLine.measureRun(TextLine.java:417)
at android.text.TextLine.measure(TextLine.java:310)
at android.text.TextLine.metrics(TextLine.java:281)
at android.text.Layout.measurePara(Layout.java:1966)
at android.text.Layout.getDesiredWidthWithLimit(Layout.java:186)
at android.widget.TextView.onMeasure(TextView.java:8168)
at android.view.View.measure(View.java:22035)
at android.widget.Toolbar.measureChildCollapseMargins(Toolbar.java:1548)
at android.widget.Toolbar.onMeasure(Toolbar.java:1662)
at android.view.View.measure(View.java:22035)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6622)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.widget.ActionBarContainer.onMeasure(ActionBarContainer.java:291)
at android.view.View.measure(View.java:22035)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6622)
at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:378)
at android.view.View.measure(View.java:22035)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:22035)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:590)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:343)
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:547)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$3(RenderTask.java:681)
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)
In xml toolbar you can find refresh button, so that it will notify if it is any warnings in your xml.
If your used custom layout then rendering problem shown..
Let see the error log:
java.lang.NullPointerException
at android.graphics.BidiRenderer.getScriptFont(BidiRenderer.java:290)
I think you need to clone project like library module, then add #Nullable to this method to avoid exception here.
if view is rendering fine at run time but you are only having problem showing preview in layout editor then you should use isInEditMode() method and should not do unsupported operations if view is being rendered in layout editor
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!isInEditMode()) {
//custom logic
}
}
I am sorry to say that your answers did not help me at all. The solution for me was to go back to one of my backup visions, when the edit display still worked, and start from there. I found that when changing too many parameters in the Theme Editor (three) cause a bug that stops the XML editor from showing the layout picture.
One of the things I learned many years ago when first started to learn programming was that there is no such thing as to many backups, this is one of those time when I am glad I listed to my teachers.
Related
When opened in an activity layout normally, the preview should appear, which should again show the preview of the layout.
But no preview is shown,
Does anyone know how solve this?
here is screen of the issue
Here is the error:
android.content.res.Resources$NotFoundException: Could not find dimen
resource matching value 0x1050050 (resolved name:
config_scrollbarSize) in current configuration. at
android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:1145)
at
android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:1121)
at
android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:1125)
at
android.content.res.Resources_Delegate.getDimensionPixelSize(Resources_Delegate.java:657)
at
android.content.res.Resources.getDimensionPixelSize(Resources.java:724)
at android.view.ViewConfiguration.(ViewConfiguration.java:366)
at android.view.ViewConfiguration.get(ViewConfiguration.java:452) at
android.view.View.(View.java:4806) at
android.view.View.(View.java:4948) at
android.view.ViewGroup.(ViewGroup.java:659) at
android.widget.RelativeLayout.(RelativeLayout.java:248) at
android.widget.RelativeLayout.(RelativeLayout.java:244) at
android.widget.RelativeLayout.(RelativeLayout.java:240) at
android.widget.RelativeLayout.(RelativeLayout.java:236) at
com.android.layoutlib.bridge.impl.Layout.(Layout.java:133) at
com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:288)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:391)
at
com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:195)
at
com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:540)
at
com.android.tools.idea.rendering.RenderTask.lambda$inflate$5(RenderTask.java:666)
at
java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
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)
It tells that config_scrollbarSize is not found in your dimens.xml file. make sure you have that in dimens.xml. Because you are using that value somewhere in that layout.
I know it has been a while. But, had the same issue, launched VS as administrator and the issue is gone.
Hi I am using Libgdx to create a game. I am currently trying to add a button to my main menu screen. I have created a stage and have added the button actor to the stage. The problem is my app crashes on start up and my logcat says there is an error reading file data/ui/uiskin.json. This is really frustrating me please can you help me solve the error.
I have followed this exactly to no avail this is also where I got the uiskin files.Using scene2d.ui with libgdx: where does the skin come from?. Sample code below.
Skin skin = new Skin(Gdx.files.internal("data/ui/uiskin.json"));
stage = new Stage();
btnlogin = new TextButton("click me",skin);
stage.addActor(btnlogin);
Render method
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
stage.draw();
Have you included the uiskin.atlas and uiskin.png in the same folder as your uiskin.json file? If not you will get an error.
The name of the atlas file must be the same as your json also, bar the file extension.
Hi all thank you for your comments. I sat up all night fumbling over this and now it is working somehow. I updated Libgdx and that has seemed to fix it somehow even though I was on the latest version.
I receive this error in Android Studio when I try to render a DatePicker:
Rendering Problems Exception raised during rendering: java/nio/charset/Charsets
When I delete the DataPicker from raw XML the error dissappears and I can work normally with my layout, but as soon as I try to add a DataPicker this error appears and I cannot see any component in the Component Tree, nor any activity in the activity view (where I operate with the design of my layout).
I'm using API 16 to render the layout (since APIs 17 & 18 are broken with CalendarView & DataPicker) and for locale I have es-ES.
What can I do to solve this error or, at least, be able to work in Design view with a DataPicker?
I am showing and hiding Eclipse view with code below. It works perfectly with Eclipse 3.3, but with Eclipse Juno (version 4.3) it's not showing the first time but showing when I fire the event for the second time.
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage();
page.showView(UserView.ID);
page.hideView(page.findView(UserView.ID));
Is somebody come across with this situation before?
I am not sure why you are not getting it the first time. Check to see if you dont have null pointer errors when you fire it the first time.
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
can return a null if the workbench is not yet loaded.
I faced the same issue with the minimized state, so I tried chaging the view's state forcing it to appear after page.showView(UserView.ID);
this piece of code got my viewPart to show :
page.showView(UserView.ID);
IWorkbenchPartReference ref = page.getReference(searchResultUI);
page.setPartState(ref,IWorkbenchPage.STATE_RESTORED); //or STATE_MAXIMIZED
Here's the fact : I made a tiny app which consist of a table related to a bar chart (a birt one ... of course), when I modify my table values it automaticaly alter my chart (like Excel but less fancy) ...
Anyway everything works fine ... BUT when I want to make my chart interactive in order to show tooltips (for example) I inform naturaly my
IDeviceRenderer
whit the following command
idr.setProperty( IDeviceRenderer.UPDATE_NOTIFIER, this );
but doing so brings an error when (much later) my code come to
gr.render(idr, gr.build(idr.getDisplayServer(), this.chart, bo, vroum,null));
(Which have never failed before) ...
I feel lost ...
ps:
The error I get are that I get no bars to my chart and receive the following error message :
org.eclipse.birt.chart.exception.ChartException
at org.eclipse.birt.chart.factory.Generator.render(Generator.java:1373)
at clickable.chart.ClickableProto.paintControl(ClickableProto.java:520)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:217)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:1424)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3842)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:337)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4541)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2371)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3420)
at clickable.chart.ClickableProto.main(ClickableProto.java:151)
Caused by: java.lang.NullPointerException
at org.eclipse.birt.chart.render.InteractiveRenderer.isColoredByCategories(InteractiveRenderer.java:197)
at org.eclipse.birt.chart.render.InteractiveRenderer.getSource(InteractiveRenderer.java:161)
at org.eclipse.birt.chart.render.InteractiveRenderer.modifyEvent(InteractiveRenderer.java:116)
at org.eclipse.birt.chart.device.swt.SwtRendererImpl.fillPolygon(SwtRendererImpl.java:502)
at org.eclipse.birt.chart.event.PolygonRenderEvent.fill(PolygonRenderEvent.java:156)
at org.eclipse.birt.chart.render.DeferredCache.flushPlanes(DeferredCache.java:499)
at org.eclipse.birt.chart.render.DeferredCache.flushOptions(DeferredCache.java:271)
at org.eclipse.birt.chart.render.DeferredCacheManager.flushOptions(DeferredCacheManager.java:165)
at org.eclipse.birt.chart.render.AxesRenderer.flushClipping(AxesRenderer.java:3416)
at org.eclipse.birt.chart.render.AxesRenderer.restoreClipping(AxesRenderer.java:3401)
at org.eclipse.birt.chart.render.Bar.renderSeries(Bar.java:1533)
at org.eclipse.birt.chart.render.AxesRenderer.renderPlot(AxesRenderer.java:2181)
at org.eclipse.birt.chart.render.AxesRenderer.render(AxesRenderer.java:314)
at org.eclipse.birt.chart.factory.Generator.render(Generator.java:1368)
... 14 more
I am open to any idea !
Finally I managed it on my own ...
So here are some common mistakes not to make when you make a chart on BIRT and wnat it to be interactive ...
1 Implement barely anything which need to be overriden
I personnaly forgot to override
getDesignTimeModel()
and
getRunTimeModel()
comming with the ICallBackNotifier implementation ...
2 Do not nest your chart (or be prepared to nest most of your methods too)
I had my chart not directly on my shell but nested in a bunch of composites widgets, canvas and such ... Therefore my canvas where hidding my shell which was the only one able to react in the way I wanted to my mouse controller.
(Funny fact : I figured this all out when I (for no reason) tried to drag a small part of my shell which was not overlapped by the chart and drop it on my bars ... There the tooltip poped ... ^^ Funny way to understand how things work :p)
3 Do not be me ...
It is to much work and pain for a barely acceptable result ;p
Hope this help, dont hesitate to mail me if you face the same probleme, I'd be glad to help as much as I can ^^