Reputation: 55
There is this project I am making, and I needed to copy an xml code from another project. After I did so, none of the xml files in my project show up in the Graphical Layout. Instead there is this warning written :
java.lang.NullPointerException
Exception details are logged in Window > Show View > Error Log
When I look it up in Error Log, I get.
Message:
chat_layout.xml: java.lang.NullPointerException
Exception Stack Trace:
java.lang.NullPointerException
at android.graphics.Bitmap_Delegate.nativeWidth(Bitmap_Delegate.java:291)
at android.graphics.Bitmap.nativeWidth(Bitmap.java)
at android.graphics.Bitmap.getWidth(Bitmap.java:909)
at android.graphics.Bitmap.getScaledWidth(Bitmap.java:957)
at android.graphics.drawable.BitmapDrawable.computeBitmapSize(BitmapDrawable.java:179)
at android.graphics.drawable.BitmapDrawable.setBitmap(BitmapDrawable.java:187)
at android.graphics.drawable.BitmapDrawable.<init>(BitmapDrawable.java:555)
at android.graphics.drawable.BitmapDrawable.<init>(BitmapDrawable.java:110)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:239)
at com.android.layoutlib.bridge.bars.CustomBar.loadIcon(CustomBar.java:196)
at com.android.layoutlib.bridge.bars.CustomBar.loadIconById(CustomBar.java:188)
at com.android.layoutlib.bridge.bars.CustomBar.loadIconById(CustomBar.java:155)
at com.android.layoutlib.bridge.bars.FakeActionBar.<init>(FakeActionBar.java:38)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:333)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:440)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1545)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1302)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1059)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:683)
at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:360)
at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:290)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:2746)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1433)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:257)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
The Graphical Layout works fine for all other xml files for all of my projects in Eclipse, except this one. Everything worked fine before the the copy. What to do ??
The xml file is as follows.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/background_dark"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/bottom_write_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<EditText
android:id="@+id/textbox"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_margin="5sp"
android:layout_weight="1"
android:hint="Write here"
android:padding="5sp"
tools:ignore="HardcodedText" />
<Button
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_margin="5sp"
android:onClick="sendMessage"
android:paddingBottom="5sp"
android:paddingLeft="15sp"
android:paddingRight="15sp"
android:paddingTop="5sp"
android:text="Send"
android:textColor="#FFF"
tools:ignore="HardcodedText" />
</LinearLayout>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_above="@id/bottom_write_bar"
android:layout_alignParentTop="true"
android:cacheColorHint="#00000000"
android:divider="#00000000"
android:listSelector="#00000000" >
</ListView>
<TextView
android:id="@android:id/empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/bottom_write_bar"
android:layout_alignParentTop="true"
android:gravity="center_vertical|center_horizontal" />
</RelativeLayout>
Upvotes: 0
Views: 5094
Reputation: 1
I also got this problem yesterday, I solved it just now. Just try to install lower or higher API level Platform SDK. At the beginning, I wished my application can work with old platform, so I created my program with old style theme, but when i edited my xml and view it with 4.3 SDK, i got this error.
Upvotes: 0
Reputation: 55
Seems I was using an incompatible icon type for my app. when I changed the Icon type it worked. It was a silly mistake but it kept me occupied :/
Upvotes: 2
Reputation: 1198
You seem to have either of the 2 issues.
Upvotes: 0