English 中文(简体)
eclipse中解析Android sdk内容和初始化java工具时出错
原标题:Error with parsing Android sdk content and initializing java tooling in eclipse

每次打开Eclipse时,我都会收到以下错误消息:

Android SDK Content Loader: parseSdkContent failed java.lang.NullPointerException

Initializing Java Tooling An internal error occured during: "Initializing Java Tooling". java.lang.NullPointerException

Loading data for Android 2.2 Parsing Data for android-8 failed java.lang.NullPointerException

Loading data for Android 2.3.3 Parsing Data for android-10 failed java.lang.NullPointerException

Loading data for Google APIs (Google Inc.) Parsing Data for Google Inc.: Google APIs:8 failed java.lang.NullPointerException

See link for screenshot: https://i.stack.imgur.com/lhhQQ.png

(我使用的是OS X Lion和Eclipse Helios)

首先,我读到一些帖子,说是.android配置文件中的AVD.ini文件造成了麻烦。我尝试删除整个.android配置文件文件夹,如Android SDK内容加载器失败,出现NullPointerException。这没有纠正我的问题。

我尝试删除整个Android SDK文件夹,再次下载并通过它安装了几个Android版本。仍然是相同的错误消息。。。

为了确保我没有任何旧的插件或其他问题,我卸载了eclipse,再次下载并安装了Android插件。(所以这个插件是最新的)。

当我进入我的一个Android项目时,我会在使用R文件访问资源的地方收到错误消息。普通的Java项目运行良好,但所有的Android项目都有带白色十字架的红色小方框。从昨天开始,我一直在寻找这个问题的解决方案,但现在我完全没有能力了,如果能得到任何帮助,我将不胜感激!

问题回答

关闭所有打开的项目并退出Eclipse。现在您可以打开Eclipse而不会出现错误。开始逐一打开你的项目,找出问题的根源。这很可能是因为您删除了AVD管理器中的设备配置文件。

不要删除所有完整的元数据

  • Backup .metadata
  • delete only .metadata/.plugins/org.eclipse.core.resources/.project
  • restart eclipse

观察:项目文件夹已创建

此外,如果您使用的是svn/git/hg有代码存储库链接,它将被销毁,因此要恢复

  • close eclipse
  • copy relevant projects from backup to merge with current projects in .metadata/.plugins/org.eclipse.core.resources/.project
  • restart eclipse

下降-可能发生偶发故障错误(同步或其他)-无害

后退

今天早上我遇到了完全相同的问题。这是一个与工作空间相关的问题。

Solution 1
I looked into my .metadata and read .bak_number.log files . Some layouts failed to parse and my projects were out of sync with the file system. So I deleted all the .bak_number.log files. Relaunch Eclipse and the whole worskspace should work again the way you left previously.

Solution 2
However if it s not due to out of sync with the file system. Change the workspace then import all the eclipse projects from the previous workspace. Thanks the project.properties files , the dependencies are still kept.

PS:我应该返回IntelliJ:)

  1. 首先关闭Eclipse

  2. Go to your workspace and rename .metadata to tushmetadata and go to tushmetadata- >.plugins -> org.eclipse.core.runtime -> .settings and copy all files from it.

  3. now open the Eclipse and go to your workspace there you can see the newly generated .metadata folder in that go to .plugins -> org.eclipse.core.runtime -> .settings and paste here and do not overwrite any file.

  4. 试着运行“Hello World”项目。

尝试从android工作区文件夹中删除file.metadata。元数据文件夹包含eclipse的所有配置文件。它对我有效。

你的答案可能是对的。我所做的是改变我的工作空间。我从git重新下载了我要处理的项目,并重新导入了它。现在它工作得很好:)也许这个项目中有一些文件导致了错误消息的出现?不知道

我已经删除了.metadata文件夹,但在删除之后,当我运行eclipse时,我无法创建任何Android项目。为了解决这个问题,我做了以下操作:

  1. Go to the main work directory of eclipse
  2. Localize the folder com.android.ide.eclipse.adt It should be in .oldMetadata/.plugins/
  3. Copy it to the new eclipse configuration: .metadata/plugins/

See the full solution here: http://www.jiahaoliuliu.com/2011/06/running-android-sdk-in-eclipse-errors.html#solution4

对我来说,NullPointerException问题的来源是一个主机端Junit测试项目,该项目引用(并测试)了Android项目中的代码。它没有项目.properties文件。这不是一个Android项目,但出于某种原因,SDK的新版本不知何故希望在那里有文件。为了解决这个问题,我刚刚将project.properties文件从Android项目复制到主机单元测试项目。

大约一年前,当我遇到这个问题时,我的工作区中有一些项目需要特定的Android SDK级别(比如2.1),但我没有在Android SDK中安装它。

斯鲁特的回答帮助很大。不过,删除.metadata或重新安装eclipse都没有成功。诀窍是隔离导致问题的项目,删除其.settings文件夹和.project文件并重新导入。

I discovered another cause, where I d added a space character into an otherwise blank line in the project.properties file. When I eventually ran android update project -p . the program (android.exe) threw a NPE exception. When I deleted the space from the blank line the android update project command worked and eclipse started behaving (after running clean a few times).

这种情况发生在Windows7 64位机器上的安卓SDK r20上。

仅供参考,我的更改修复了项目中的问题。属性http://code.google.com/p/android-daisy-epub-reader/source/detail?r=517一

This is just weired. In my case when I took a subversion update, I was getting this problem. The reason was the corruption of my project.properties file (due to subversion conflict). I just corrected the file and problem got solved.

我发现它只是在项目文件夹中缺少project.properties文件。从另一个项目复制一个之后,错误就消失了。project.properties中唯一有效的行是

target=android-8

If you are using SVN or GIT please check whether the project.properties has conflicts or not. Sometimes project can not be open because of this.

我希望这对某人有用,并节省他/她的时间:我的同事也面临着同样的问题,我们几乎做了这里提到的所有事情,但运气不佳。最后,我们在清单文件中更改了Android SDK的版本,它成功了。

这个解决方案对我有效。

关闭Eclipse并删除工作区文件夹中的所有.markers。

重新启动Eclipse(有一次我不得不重新启动它两次,它挂在第一次上,但毫无理由地在第二次上工作)。

当然,首先备份它们总是安全的。





相关问题
In Eclipse, why doesn t "Show In" appear for non-Java files?

If I have a *java file open, I can right click on the source, scroll down to "Show In (Alt-Shift-W)", and select Navigator. If I have an *xml, *jsp, or pretty much anything besides a Java source ...

Eclipse: Hover broken in debug perspective

Since upgrading Eclipse (Galileo build 20090920-1017), hover in debug no longer displays a variable s value. Instead, hover behaves as if I were in normal Java perspective: alt text http://...

Eclipse smart quotes - like in Textmate

Happy Friday — Does anyone know if eclipse has the notion of smart quotes like Textmate. The way it works is to select some words and quote them by simply hitting the " key? I m a newbie here so be ...

Indentation guide for the eclipse editor

Is there a setting or plugin for eclipse that can show indentation guides in the editor? Something like the Codekana plugin for visual studio (not so fancy is also OK). Important that it works with ...

Adding jar from Eclipse plugin runtime tab

I want to add .jar files for plugin from the Runtime tab of manifest file. When I use the Add... button, I can see only sub-directories of the plugin project. So if I want to add same .jar file to ...

How to copy multiple projects into single folder in eclipse

I have two projects, Project1 and Project2. Now i want to copy this projects into eclipse workspace but i want these projects to be in a single folder like below. Eclipse Workspace -> Project -> ...

Java: Finding out what is using all the memory

I have a java application that runs out of memory, but I have no idea which code is allocating the memory. Is there an application with which I can check this? I use Eclipse.

热门标签