Siri
Siri

Reputation: 701

Android xml rendering issue in eclipse?

On creating new xml files in a project, rendering issue occur with error log as follows:

java.lang.NullPointerException
    Exception details are logged in Window > Show View > Error Log
    The following classes could not be instantiated:
    - android.support.v7.internal.app.WindowDecorActionBar (Open Class, Show Error Log)
    - android.support.v7.internal.widget.ActionBarContextView (Open Class, Show Error Log)
    - android.support.v7.widget.Toolbar (Open Class, Show Error Log)

...............

java.lang.NullPointerException
    at android.support.v7.internal.widget.ActionBarOverlayLayout.getDecorToolbar(ActionBarOverlayLayout.java:594)
    at android.support.v7.internal.widget.ActionBarOverlayLayout.pullChildren(ActionBarOverlayLayout.java:583)
    at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:368)
    at android.view.View.measure(View.java:17547)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17547)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:875)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17547)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:637)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:537)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:323)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:349)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:519)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1584)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1309)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1066)
    at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegateActivated(LayoutEditorDelegate.java:743)
    at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.activated(CommonXmlEditor.java:416)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.LayoutWindowCoordinator.partActivated(LayoutWindowCoordinator.java:379)
    at org.eclipse.ui.internal.PartService$6.run(PartService.java:149)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.PartService.partActivated(PartService.java:146)
    at org.eclipse.ui.internal.WorkbenchPage$17.run(WorkbenchPage.java:4870)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.WorkbenchPage.firePartActivated(WorkbenchPage.java:4867)
    at org.eclipse.ui.internal.WorkbenchPage.access$18(WorkbenchPage.java:4846)
    at org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partActivated(WorkbenchPage.java:210)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$3.run(PartServiceImpl.java:241)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.firePartActivated(PartServiceImpl.java:238)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:692)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:620)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:608)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.hidePart(PartServiceImpl.java:1276)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.hidePart(PartServiceImpl.java:1215)
    at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.closePart(StackRenderer.java:1218)
    at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.access$3(StackRenderer.java:1200)
    at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$12.close(StackRenderer.java:1092)
    at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1874)
    at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:288)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

Upvotes: 14

Views: 26937

Answers (8)

ömer
ömer

Reputation: 1

I solved it by changing the AndroidManifest.xml:

android:targetSdkVersion="21" to android:targetSdkVersion="22"

Then change ActionBarActivity to Activity.

Upvotes: 0

vjs3
vjs3

Reputation: 158

I start my eclipse again it works fine now. Also in some cases it might occur on creating a new activity, in that case you need to remove some access generated code in AndroidManifest.xml file.

Upvotes: 0

S.Ahsan
S.Ahsan

Reputation: 399

Google has been deprecated the Class ActionBarActivity.If your 'Activity Class' extends it, this error occurs.

  1. First Change the ActionBarActivityto Activity and save Changes.
  2. Then, restart your IDE and see error is fixed.

Upvotes: 3

I just got the same error and have solved this.

I've created a new project and selected API 21. After the project was created I changed in the file AndroidManifest.xml:

android:targetSdkVersion="21" 

to

android:targetSdkVersion="22"

Upvotes: 0

Siri
Siri

Reputation: 701

I restarted my eclipse. Its working fine now. The problem is sdk is not loaded properly in my eclipse.

Try to start eclipse otherwise once check your sdk manager is everything installed or not.

Upvotes: 22

Haziq Sheikh
Haziq Sheikh

Reputation: 83

I Was Getting The Same Error !!

But What I have Learned Is when I go Below API 14 i gt the Error Otherwise It works Fine ....

The issue was fixed in an update to 4.1 SDK, but the fix has not been backported to older versions of the layout library -- yet. I believe Xav is planning on doing that along with a few other misc layoutlib fixes that have accumulated.

Upvotes: 0

zhijuexu
zhijuexu

Reputation: 199

I have met the same problem When using Eclipse with ADT (both are the latest version).

It seems like a bug of adt, the only solution I found (but a simple one) is just restart Eclipse, then the errors disappear.

Upvotes: 6

AmDroid
AmDroid

Reputation: 131

Have you used any fragment in your xml? please add the library supported for fragmnet named "android-support-v7-appcompat"

Upvotes: 2

Related Questions