新的android应用程序的构build过程中没有project.properties文件和NullPointerException

我有一个可怕的时间算出一个问题,使我不可能在ADT中使用新的Android应用程序向导来创build一个新的Android项目。 先有一点背景。 我一直在使用ADT(ADT软件包)大约6个月,并没有问题。 因为当前的问题只是在创build新项目时才显现出来(现有项目build设没有任何问题),而且一段时间以来我也没有创build一个新项目,所以我不知道是什么导致了这个问题。 我能想到的两件事是:

  1. 我最近更新我的操作系统小牛队。
  2. 我最近安装了JDK 7(我一直在用6)

在这里和这里提出了类似的问题,但答案的质量对我来说似乎不是很好。 首先,除非这是一个合法的错误,否则我不需要解决方法。 这对我来说似乎不是一个错误,因为我认为更多的人会遇到问题。 这是一个相当大的问题。 我想我一定会错过一些相当明显的东西。

我可以看到,在它试图创build项目后,工作区中项目的目录结构显示正确,但几乎所有的文件都丢失了,包括project.properties,这似乎涉及到我所基于的问题在错误日志(下面)。

我做了以下:

  1. 首先我试着更新eclipse和ADT。 没有运气
  2. 我试图在新的工作区中创build项目
  3. 我删除并重新下载了ADT软件包
  4. 我删除并重新安装了JDK 7(遵循oracle的卸载指示)

点击完成使用新的Android应用程序向导时,我得到以下错误信息:

Errors occurred during the build. Errors running builder 'Android Resource Manager' on project 'test'. java.lang.NullPointerException 

错误日志看起来像这样(我想包括一个屏幕截图,但该网站不会让我因为我是一个新用户,而是按照它们出现在我的日志中的顺序来复制和粘贴消息最近的到最近的):

 Errors occurred during the build. Errors running builder 'Android Resource Manager' on project 'test'. Failed to load properties file for project 'test' Failed to load properties file for project 'test' Problems occurred when invoking code from plug-in: "org.eclipse.core.resources". Failed to load properties file for project 'test' [No message for this one, but stack trace is for an InvocationTargetException] Failed to load properties file for project 'test' Failed to load properties file for project 'test' 

最后,这里是NPE和InvocationTargetException的堆栈跟踪。

 java.lang.NullPointerException at com.android.ide.eclipse.adt.internal.build.builders.BaseBuilder.abortOnBadSetup(BaseBuilder.java:327) at com.android.ide.eclipse.adt.internal.build.builders.ResourceManagerBuilder.build(ResourceManagerBuilder.java:92) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:733) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:358) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:381) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53) java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421) at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1028) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateWizard.performFinish(TemplateWizard.java:197) at com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectWizard.performFinish(NewProjectWizard.java:1) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:827) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:432) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:628) 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:4166) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651) at org.eclipse.jface.window.Window.runEventLoop(Window.java:826) at org.eclipse.jface.window.Window.open(Window.java:802) at org.eclipse.ui.internal.actions.NewWizardShortcutAction.run(NewWizardShortcutAction.java:135) at org.eclipse.jface.action.Action.runWithEvent(Action.java:499) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) 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:354) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181) 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:606) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591) at org.eclipse.equinox.launcher.Main.run(Main.java:1450) Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.android.xml.AndroidXPathFactory at com.android.manifmerger.ManifestMerger.process(ManifestMerger.java:332) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateHandler.mergeManifest(TemplateHandler.java:909) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateHandler.merge(TemplateHandler.java:745) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateHandler.access$7(TemplateHandler.java:690) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateHandler$2.startElement(TemplateHandler.java:614) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509) at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1342) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2770) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:332) at javax.xml.parsers.SAXParser.parse(SAXParser.java:195) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateHandler.execute(TemplateHandler.java:580) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateHandler.access$1(TemplateHandler.java:563) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateHandler$1.startElement(TemplateHandler.java:489) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509) at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1342) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2770) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:332) at javax.xml.parsers.SAXParser.parse(SAXParser.java:195) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateHandler.processVariables(TemplateHandler.java:456) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateHandler.render(TemplateHandler.java:310) at com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectWizard.generateActivity(NewProjectWizard.java:418) at com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectWizard.access$5(NewProjectWizard.java:401) at com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectWizard$2.populate(NewProjectWizard.java:354) at com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreator.createEclipseProject(NewProjectCreator.java:759) at com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreator.access$1(NewProjectCreator.java:712) at com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreator$5.run(NewProjectCreator.java:914) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327) at com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreator.create(NewProjectCreator.java:933) at com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectWizard.performFinish(NewProjectWizard.java:359) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateWizard$1.run(TemplateWizard.java:201) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) 

这是我在stackoverflow上的第一个问题。 请让我知道如何改善它。 我正在使用eclipse version 22.6.2-1085508

  java version 1.7.0_60 

Solutions Collecting From Web of "新的android应用程序的构build过程中没有project.properties文件和NullPointerException"

好吧,因为我无法解决这个问题,我已经切换到Android Studio,并没有任何问题,但是当我最近有一台新电脑时,我想我可以回到ADT捆绑没有问题。 错误。 我有完全相同的问题。

我不明白为什么,但卸载jdk1.7.0_60.jdk“解决了”这个问题。 我有这个想法,尝试从其他一些问题的答案(不幸的是,我很难find他们再次链接)。 无论如何,我还没有find解释为什么这个工作或任何build议如何实现它,而无需卸载我的JDK(我需要)。 任何答案或暗示,将导致我在正确的方向来找出原因,将不胜感激。 否则,我想我会提出一个新的问题。

更新

我重新安装了JDK,并没有出现问题。

你只修复eclipse.ini … openFile –launcher.appendVmargs -vm /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java -vmargs -Dosgi.requiredJavaVersion = 1.6 -XstartOnFirstThread …祝你好运

我打开de eclipse.ini并将-Dosgi.requiredJavaVersion =参数从1.7更改为1.6,当然,我在机器上安装了java 6,它适用于我。 我希望它可以帮助你。