我正在建立一个全新的android项目。这不是我的第一个android应用程序,所以我更沮丧的是无法摆脱此错误…
我使用的XML文件目前只有3个项目,并且XML标签中没有错误:
<?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:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".gaming..MainActivity" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/fondipad" android:contentDescription="@string/FondDesc" /> <RelativeLayout android:layout_height="300dp" android:layout_width="fill_parent" android:background="@drawable/cadremenu"> </RelativeLayout> </RelativeLayout>
很简单,是吗?但是,视觉选项卡不会使cadremenu可绘制(但“喜欢”会呈现)…但是cadremenu.png在drawable文件夹中!我可以启动应用程序,但只渲染背景…我真的不知道该怎么办… xml文件返回此异常
java.lang.NullPointerException at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:598) at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:120) at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:102) at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:233) at android.content.res.BridgeTypedArray.getDrawable(BridgeTypedArray.java:782) at android.view.View.<init>(View.java:3554) at android.view.View.<init>(View.java:3484) at android.view.ViewGroup.<init>(ViewGroup.java:464) at android.widget.RelativeLayout.<init>(RelativeLayout.java:236) at sun.reflect.GeneratedConstructorAccessor37.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at android.view.LayoutInflater.createView(LayoutInflater.java:594) at android.view.BridgeInflater.onCreateView(BridgeInflater.java:86) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:131) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:727) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:373) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:399) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:336) at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:332) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:504) 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.delegatePageChange(LayoutEditorDelegate.java:686) at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:360) at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:292) 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.Display.sendEvent(Display.java:4136) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1481) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1271) at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3028) at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1749) at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:278) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4136) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1481) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1271) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3982) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3621) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543) 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:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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)
任何帮助都将受到欢迎!
编辑:我已经尝试过删除,放回可绘制对象,项目,…。清理项目,重新构建…我什至尝试删除并重新安装每个ADT组件
正如@laato所建议的,我检查了我的drawable / cadremenu文件。我在项目中复制/粘贴/覆盖了文件,然后一切正常!实际上,我所有其他资源都有相同的问题,例如我的资源文件夹已损坏或类似问题。
谢谢大家,希望有一天有人能在这里找到帮助